From d621ca03cba813f096e87759ac8706a82152a6b4 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 | 38 +++++++++++++++++++ 1 file changed, 38 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..20c5b87b2b5c2 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,41 @@ public void testBug9025() { public void testBug9036() { RestAssured.when().get("/test/9036").then().body(is("OK")); } + + @DisabledOnNativeImage + @Transactional + @Test + void testBug7102InOneTransaction() { + testBug7102(); + } + + @DisabledOnNativeImage + @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); + } }