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:
parent
7ee7140744
commit
1e9deb3f04
|
@ -163,11 +163,15 @@ public class JDBCContext implements Serializable, ConnectionManager.Callback {
|
||||||
else {
|
else {
|
||||||
javax.transaction.Transaction tx = tm.getTransaction();
|
javax.transaction.Transaction tx = tm.getTransaction();
|
||||||
if ( JTAHelper.isMarkedForRollback( tx ) ) {
|
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" );
|
log.debug( "Transaction is marked for rollback; skipping Synchronization registration" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
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;
|
isTransactionCallbackRegistered = true;
|
||||||
log.debug("successfully registered Synchronization");
|
log.debug("successfully registered Synchronization");
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue