Skip to content

Commit 4a65c51

Browse files
Siggenbeikov
authored andcommitted
HHH-18491 Do no try to resume non-existant transaction in doInSuspendedTransaction.
1 parent 7b176df commit 4a65c51

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

hibernate-core/src/main/java/org/hibernate/resource/transaction/backend/jta/internal/JtaIsolationDelegate.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ private <T> T doInSuspendedTransaction(HibernateCallable<T> callable) {
114114
try {
115115
// First we suspend any current JTA transaction
116116
final Transaction surroundingTransaction = transactionManager.suspend();
117-
LOG.debugf( "Surrounding JTA transaction suspended [%s]", surroundingTransaction );
117+
if ( surroundingTransaction != null ) {
118+
LOG.debugf( "Surrounding JTA transaction suspended [%s]", surroundingTransaction );
119+
}
118120

119121
try {
120122
return callable.call();
@@ -124,8 +126,10 @@ private <T> T doInSuspendedTransaction(HibernateCallable<T> callable) {
124126
}
125127
finally {
126128
try {
127-
transactionManager.resume( surroundingTransaction );
128-
LOG.debugf( "Surrounding JTA transaction resumed [%s]", surroundingTransaction );
129+
if ( surroundingTransaction != null ) {
130+
transactionManager.resume( surroundingTransaction );
131+
LOG.debugf( "Surrounding JTA transaction resumed [%s]", surroundingTransaction );
132+
}
129133
}
130134
catch ( Throwable t2 ) {
131135
// if the actually work had an error use that, otherwise error based on t

0 commit comments

Comments
 (0)