HHH-12139 - Allow Hibernate's Transaction act like JPA's EntityTransaction

This commit is contained in:
Steve Ebersole 2017-12-01 15:05:42 -06:00
parent 4b3a18a5b4
commit e960f17a7b
1 changed files with 10 additions and 8 deletions

View File

@ -244,19 +244,21 @@ public class JdbcResourceLocalTransactionCoordinatorImpl implements TransactionC
try { try {
rollback(); rollback();
if ( jpaCompliance.isJpaTransactionComplianceEnabled() ) {
log.debugf( "Throwing RollbackException on roll-back of transaction marked rollback-only on commit" );
throw new RollbackException( "Transaction was marked for rollback-only" );
}
return;
}
catch (RollbackException e) {
throw e;
} }
catch (RuntimeException e) { catch (RuntimeException e) {
log.debug( "Encountered failure rolling back failed commit", e ); log.debug( "Encountered failure rolling back failed commit", e );
throw e; throw e;
} }
finally {
if ( jpaCompliance.isJpaTransactionComplianceEnabled() ) {
throw new RollbackException( "Transaction was marked for rollback-only" );
}
else {
return;
}
}
} }
JdbcResourceLocalTransactionCoordinatorImpl.this.beforeCompletionCallback(); JdbcResourceLocalTransactionCoordinatorImpl.this.beforeCompletionCallback();