Skip to content

Commit 3f9c364

Browse files
Siggenbeikov
authored andcommitted
HHH-18491 Do no try to resume non-existant transaction in doInSuspendedTransaction.
1 parent 5a04c37 commit 3f9c364

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
@@ -117,7 +117,9 @@ private <T> T doInSuspendedTransaction(HibernateCallable<T> callable) {
117117
try {
118118
// First we suspend any current JTA transaction
119119
final Transaction surroundingTransaction = transactionManager.suspend();
120-
LOG.debugf( "Surrounding JTA transaction suspended [%s]", surroundingTransaction );
120+
if ( surroundingTransaction != null ) {
121+
LOG.debugf( "Surrounding JTA transaction suspended [%s]", surroundingTransaction );
122+
}
121123

122124
try {
123125
return callable.call();
@@ -127,8 +129,10 @@ private <T> T doInSuspendedTransaction(HibernateCallable<T> callable) {
127129
}
128130
finally {
129131
try {
130-
transactionManager.resume( surroundingTransaction );
131-
LOG.debugf( "Surrounding JTA transaction resumed [%s]", surroundingTransaction );
132+
if ( surroundingTransaction != null ) {
133+
transactionManager.resume( surroundingTransaction );
134+
LOG.debugf( "Surrounding JTA transaction resumed [%s]", surroundingTransaction );
135+
}
132136
}
133137
catch ( Throwable t2 ) {
134138
// if the actually work had an error use that, otherwise error based on t

0 commit comments

Comments
 (0)