Skip to content

Commit

Permalink
Let the session join JTA transactions implicitly
Browse files Browse the repository at this point in the history
The call to joinTransaction() is not necessary, the Session already
joins the transaction when it starts.

Signed-off-by: Yoann Rodière <yoann@hibernate.org>
  • Loading branch information
yrodiere committed Feb 5, 2021
1 parent efc2b8e commit b18bede
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b18bede

Please sign in to comment.