No auto transaction joining from SessionImpl.doFlush

Description

In SessionImpl.doFlush the call to checkTransactionNeededForUpdateOperation will throw an exception TransactionRequiredException if the session was opened before a transaction started, and no other major session methods have been called yet (in case of a JTA setup).
This is because the TransactionCoordinator returns false on isTransactionActive when isJoined is false.
In most other major session methods a call to pulseTransactionCoordinator is done which would auto join an available transaction. This is also done in doFlush but only after the call to checkTransactionNeededForUpdateOperation.
If these calls would be switched around the session would join the active transaction and doFlush would succeed successfully.

I don't know how long this issue existed, but at least since 5.4.12

Environment

None

Activity

Show:
Michiel Hendriks
April 20, 2020, 6:55 AM

I hate to nag, but any word on accepting this patch?

It is blocking our effort to upgrade to hibernate 5 and our release deadline is approaching.

Sanne Grinovero
May 19, 2020, 8:24 AM

Backported to branch 5.3 as well.

Assignee

Michiel Hendriks

Reporter

Michiel Hendriks

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure