From a15dfe0e056c55664846b621c0d880ef2e367fff Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Fri, 9 Nov 2018 09:15:07 +0000 Subject: [PATCH] HHH-13076 - Hibernate 'Transaction already active' behaviour with JTA transaction manager --- .../engine/transaction/internal/TransactionImpl.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/TransactionImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/TransactionImpl.java index 33d03f6f63..42879d569e 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/TransactionImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/transaction/internal/TransactionImpl.java @@ -72,7 +72,13 @@ public class TransactionImpl implements TransactionImplementor { // per-JPA if ( isActive() ) { - throw new IllegalStateException( "Transaction already active" ); + if ( jpaCompliance.isJpaTransactionComplianceEnabled() + || !transactionCoordinator.getTransactionCoordinatorBuilder().isJta() ) { + throw new IllegalStateException( "Transaction already active" ); + } + else { + return; + } } LOG.debug( "begin" );