[hibernate-dev] afterTransactionCompletion(status) in JtaTransaction

Sanne Grinovero sanne at hibernate.org
Wed Jul 18 06:15:20 EDT 2012


Hi all,
I'm puzzled about the implementation we have in
org.hibernate.engine.transaction.internal.jta.JtaTransaction

regarding after-transaction completion handling.

Looking at the two methods:
afterAfterCompletion();  <-- note the "After - After" prefix
afterTransactionCompletion(int status);


The implementation of afterTransactionCompletion(int status) is a
no-op, while after-after-completion actually invokes the
transactionCoordinator().afterTransaction( this,
userTransaction.getStatus() );
Shouldn't this be invoked in the afterTransactionCompletion(status) method?

As I just noticed in some OGM tests, during the after-after phase it's
too late to invoke the getStatus() on the transaction as this will
have been cleaned up already: that's why the
afterTransactionCompletion(int) has a status parameter, as the status
argument should be used rather than attempting to lookup the
transaction state again.

OGM is having it's own AbstractTransactionImpl implementation;
changing it by moving the afterTransaction call in the appropriate
method fixed my problems to our Search integration.

This looks like a change that should be picked up by ORM's
JtaTransaction too? I'm not familiar with this, so I might be totally
wrong but in case I would love to understand why.

Cheers,
Sanne


More information about the hibernate-dev mailing list