Skip to content

Commit b2c9724

Browse files
committed
HHH-9685 - Envers should do nothing when JTA transaction is already marked as rollback-only
(cherry picked from commit a6f3319)
1 parent 3305c71 commit b2c9724

File tree

1 file changed

+9
-0
lines changed
  • hibernate-envers/src/main/java/org/hibernate/envers/internal/synchronization

1 file changed

+9
-0
lines changed

hibernate-envers/src/main/java/org/hibernate/envers/internal/synchronization/AuditProcess.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@
2020
import org.hibernate.envers.internal.synchronization.work.AuditWorkUnit;
2121
import org.hibernate.envers.tools.Pair;
2222

23+
import org.jboss.logging.Logger;
24+
2325
/**
2426
* @author Adam Warski (adam at warski dot org)
2527
*/
2628
public class AuditProcess implements BeforeTransactionCompletionProcess {
29+
private static final Logger log = Logger.getLogger( AuditProcess.class );
30+
2731
private final RevisionInfoGenerator revisionInfoGenerator;
2832
private final SessionImplementor session;
2933

@@ -124,6 +128,11 @@ public void doBeforeTransactionCompletion(SessionImplementor session) {
124128
return;
125129
}
126130

131+
if ( !session.getTransactionCoordinator().isActive() ) {
132+
log.debug( "Skipping envers transaction hook due to non-active (most likely marked-rollback-only) transaction" );
133+
return;
134+
}
135+
127136
// see: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4178431
128137
if ( FlushMode.isManualFlushMode( session.getFlushMode() ) ) {
129138
Session temporarySession = null;

0 commit comments

Comments
 (0)