HHH-1956 : Interceptor.afterTransactionCompletion() and JTA

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14314 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2008-02-07 02:08:26 +00:00
parent 7ee7140744
commit 1e9deb3f04
1 changed files with 5 additions and 1 deletions

View File

@ -163,11 +163,15 @@ public class JDBCContext implements Serializable, ConnectionManager.Callback {
else {
javax.transaction.Transaction tx = tm.getTransaction();
if ( JTAHelper.isMarkedForRollback( tx ) ) {
// transactions marked for rollback-only cause some TM impls to throw exceptions
log.debug( "Transaction is marked for rollback; skipping Synchronization registration" );
return false;
}
else {
tx.registerSynchronization( new CacheSynchronization(owner, this, tx, null) );
if ( hibernateTransaction == null ) {
hibernateTransaction = owner.getFactory().getSettings().getTransactionFactory().createTransaction( this, owner );
}
tx.registerSynchronization( new CacheSynchronization(owner, this, tx, hibernateTransaction) );
isTransactionCallbackRegistered = true;
log.debug("successfully registered Synchronization");
return true;