From a6830c9f8ecc407097e84ed993906cbb0e719587 Mon Sep 17 00:00:00 2001 From: Stephane Epardaud Date: Mon, 25 May 2020 14:47:40 +0200 Subject: [PATCH] Test for #7102 --- .../it/panache/PanacheFunctionalityTest.java | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/integration-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/PanacheFunctionalityTest.java b/integration-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/PanacheFunctionalityTest.java index bc946c5184d96..af10672ef737e 100644 --- a/integration-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/PanacheFunctionalityTest.java +++ b/integration-tests/hibernate-orm-panache/src/test/java/io/quarkus/it/panache/PanacheFunctionalityTest.java @@ -7,6 +7,7 @@ import javax.json.bind.Jsonb; import javax.json.bind.JsonbBuilder; +import javax.transaction.Transactional; import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Marshaller; @@ -174,4 +175,39 @@ public void testBug9025() { public void testBug9036() { RestAssured.when().get("/test/9036").then().body(is("OK")); } + + @Transactional + @Test + void testBug7102InOneTransaction() { + testBug7102(); + } + + @Test + public void testBug7102() { + Person person = createBug7102(); + Person person1 = getBug7102(person.id); + Assertions.assertEquals("pero", person1.name); + updateBug7102(person.id); + Person person2 = getBug7102(person.id); + Assertions.assertEquals("jozo", person2.name); + } + + @Transactional + Person createBug7102() { + Person personPanache = new Person(); + personPanache.name = "pero"; + personPanache.persistAndFlush(); + return personPanache; + } + + @Transactional + void updateBug7102(Long id) { + final Person person = Person.findById(id); + person.name = "jozo"; + } + + @Transactional + Person getBug7102(Long id) { + return Person.findById(id); + } }