JtaTransaction doesn't call Synchronization methods correctly if it is the initiator
Description
Activity
Steve EbersoleOctober 28, 2015 at 3:24 AM
As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.
Steve EbersoleOctober 27, 2015 at 7:15 PM
This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.
For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/
Steve EbersoleSeptember 24, 2015 at 3:39 PM
Please verify this affects 5.0 as well. 4.x is no longer maintained, and transaction handling underwent a major overhaul in 5.0

Karl von RandowSeptember 10, 2015 at 2:11 AM
Or perhaps afterAfterCompletion()
should use the localStatus
ivar instead of the status from the UserTransaction.
Details
Assignee
UnassignedUnassignedReporter
Karl von RandowKarl von RandowLabels
Components
Affects versions
Priority
Major
Details
Details
Assignee
Reporter

If JtaTransaction is the initiator of the UserTransaction, when you register a synchronization it doesn't register a synchronization with the JtaPlatform (see
TransactionCoordinatorImpl.java:227
).When the JtaTransaction commits, it commits the UserTransaction (as the JtaTransaction is the initiator of it), but
afterTransactionCompletion(int status)
in JtaTransaction is a noop, so the Synchronization is not called here.The Synchronization is called by
afterAfterCompletion()
in JtaTransaction, passing the status of the UserTransaction. However at this time the UserTransaction has been committed and is now gone, souserTransaction.getStatus()
returnsSTATUS_NO_TRANSACTION
.What I expect is for the Synchronization to be called with the
STATUS_COMMITTED
status (as this is what happened), however it is called with theSTATUS_NO_TRANSACTION
status.Is this a fault? I have "remedied" it by sending completion notifications in
afterTransactionCompletion(int status)
... although this results inafterAfterCompletion()
still reporting theSTATUS_NO_TRANSACTION
afterwards (unless I calltransactionCoordinator().afterTransaction( this, status );
inafterTransactionCompletion(int status)
... but I'm not sure whether I'm doing right!)