Fix TransactionJoiningTest

This commit is contained in:
Andrea Boriero 2016-05-03 17:58:26 +01:00 committed by Steve Ebersole
parent 2a252d5015
commit 2e1d1a6f16
3 changed files with 35 additions and 9 deletions

View File

@ -34,6 +34,7 @@ public class TransactionImpl implements TransactionImplementor {
public TransactionImpl(TransactionCoordinator transactionCoordinator, ExceptionConverter exceptionConverter) {
this.transactionCoordinator = transactionCoordinator;
this.exceptionConverter = exceptionConverter;
transactionDriverControl = transactionCoordinator.getTransactionDriverControl();
}
@Override

View File

@ -335,9 +335,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
@Override
public void markForRollbackOnly() {
if ( currentHibernateTransaction != null ) {
currentHibernateTransaction.markRollbackOnly();
}
accessTransaction().markRollbackOnly();
}
@Override

View File

@ -847,10 +847,9 @@ public final class SessionImpl
private Object fireMerge(MergeEvent event) {
checkOpen();
try {
checkTransactionSynchStatus();
checkNoUnresolvedActionsBeforeOperation();
try {
for ( MergeEventListener listener : listeners( EventType.MERGE ) ) {
listener.onMerge( event );
}
@ -872,9 +871,9 @@ public final class SessionImpl
private void fireMerge(Map copiedAlready, MergeEvent event) {
checkOpen();
checkTransactionSynchStatus();
try {
checkTransactionSynchStatus();
for ( MergeEventListener listener : listeners( EventType.MERGE ) ) {
listener.onMerge( event, copiedAlready );
}
@ -958,21 +957,49 @@ public final class SessionImpl
private void fireDelete(DeleteEvent event) {
checkOpen();
try{
checkTransactionSynchStatus();
for ( DeleteEventListener listener : listeners( EventType.DELETE ) ) {
listener.onDelete( event );
}
}
catch ( ObjectDeletedException sse ) {
throw exceptionConverter.convert( new IllegalArgumentException( sse ) );
}
catch ( MappingException e ) {
throw exceptionConverter.convert( new IllegalArgumentException( e.getMessage(), e ) );
}
catch ( RuntimeException e ) {
//including HibernateException
throw exceptionConverter.convert( e );
}
finally {
delayedAfterCompletion();
}
}
private void fireDelete(DeleteEvent event, Set transientEntities) {
checkOpen();
try{
checkTransactionSynchStatus();
for ( DeleteEventListener listener : listeners( EventType.DELETE ) ) {
listener.onDelete( event, transientEntities );
}
}
catch ( ObjectDeletedException sse ) {
throw exceptionConverter.convert( new IllegalArgumentException( sse ) );
}
catch ( MappingException e ) {
throw exceptionConverter.convert( new IllegalArgumentException( e.getMessage(), e ) );
}
catch ( RuntimeException e ) {
//including HibernateException
throw exceptionConverter.convert( e );
}
finally {
delayedAfterCompletion();
}
}
// load()/get() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~