From b18bede515528ec46b116e10460a1a2c243bbf5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Wed, 13 Jan 2021 17:17:32 +0100 Subject: [PATCH] Let the session join JTA transactions implicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The call to joinTransaction() is not necessary, the Session already joins the transaction when it starts. Signed-off-by: Yoann Rodière --- .../hibernate/orm/runtime/session/TransactionScopedSession.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedSession.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedSession.java index 21c89cf29d9fec..f4046bfaee1233 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedSession.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedSession.java @@ -83,7 +83,7 @@ SessionResult acquireSession() { return new SessionResult(session, false, true); } Session newSession = sessionFactory.openSession(); - newSession.joinTransaction(); + // The session has automatically joined the JTA transaction when it was constructed. transactionSynchronizationRegistry.putResource(sessionKey, newSession); // No need to flush or close the session upon transaction completion: // Hibernate ORM itself registers a transaction that does just that.