HHH-9685 - Envers should do nothing when JTA transaction is already marked as rollback-only
(cherry picked from commit a6f3319eaf
)
This commit is contained in:
parent
3305c71fbc
commit
b2c9724905
|
@ -20,10 +20,14 @@ import org.hibernate.envers.internal.revisioninfo.RevisionInfoGenerator;
|
||||||
import org.hibernate.envers.internal.synchronization.work.AuditWorkUnit;
|
import org.hibernate.envers.internal.synchronization.work.AuditWorkUnit;
|
||||||
import org.hibernate.envers.tools.Pair;
|
import org.hibernate.envers.tools.Pair;
|
||||||
|
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Adam Warski (adam at warski dot org)
|
* @author Adam Warski (adam at warski dot org)
|
||||||
*/
|
*/
|
||||||
public class AuditProcess implements BeforeTransactionCompletionProcess {
|
public class AuditProcess implements BeforeTransactionCompletionProcess {
|
||||||
|
private static final Logger log = Logger.getLogger( AuditProcess.class );
|
||||||
|
|
||||||
private final RevisionInfoGenerator revisionInfoGenerator;
|
private final RevisionInfoGenerator revisionInfoGenerator;
|
||||||
private final SessionImplementor session;
|
private final SessionImplementor session;
|
||||||
|
|
||||||
|
@ -124,6 +128,11 @@ public class AuditProcess implements BeforeTransactionCompletionProcess {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( !session.getTransactionCoordinator().isActive() ) {
|
||||||
|
log.debug( "Skipping envers transaction hook due to non-active (most likely marked-rollback-only) transaction" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// see: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4178431
|
// see: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4178431
|
||||||
if ( FlushMode.isManualFlushMode( session.getFlushMode() ) ) {
|
if ( FlushMode.isManualFlushMode( session.getFlushMode() ) ) {
|
||||||
Session temporarySession = null;
|
Session temporarySession = null;
|
||||||
|
|
Loading…
Reference in New Issue