Skip to content

Commit

Permalink
Fix TransactionJoiningTest
Browse files Browse the repository at this point in the history
  • Loading branch information
dreab8 authored and sebersole committed May 6, 2016
1 parent 2a252d5 commit 2e1d1a6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 9 deletions.
Expand Up @@ -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
Expand Down
Expand Up @@ -335,9 +335,7 @@ protected void errorIfClosed() {

@Override
public void markForRollbackOnly() {
if ( currentHibernateTransaction != null ) {
currentHibernateTransaction.markRollbackOnly();
}
accessTransaction().markRollbackOnly();
}

@Override
Expand Down
Expand Up @@ -847,10 +847,9 @@ public void merge(String entityName, Object object, Map copiedAlready) throws Hi

private Object fireMerge(MergeEvent event) {
checkOpen();
checkTransactionSynchStatus();
checkNoUnresolvedActionsBeforeOperation();

try {
checkTransactionSynchStatus();
checkNoUnresolvedActionsBeforeOperation();
for ( MergeEventListener listener : listeners( EventType.MERGE ) ) {
listener.onMerge( event );
}
Expand All @@ -872,9 +871,9 @@ private Object fireMerge(MergeEvent event) {

private void fireMerge(Map copiedAlready, MergeEvent event) {
checkOpen();
checkTransactionSynchStatus();

try {
checkTransactionSynchStatus();
for ( MergeEventListener listener : listeners( EventType.MERGE ) ) {
listener.onMerge( event, copiedAlready );
}
Expand Down Expand Up @@ -958,20 +957,48 @@ private void logRemoveOrphanBeforeUpdates(String timing, String entityName, Obje

private void fireDelete(DeleteEvent event) {
checkOpen();
try{
checkTransactionSynchStatus();
for ( DeleteEventListener listener : listeners( EventType.DELETE ) ) {
listener.onDelete( event );
}
delayedAfterCompletion();
}
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 );
}
delayedAfterCompletion();
}
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();
}
}


Expand Down

0 comments on commit 2e1d1a6

Please sign in to comment.