HHH-18491 Do no try to resume non-existant transaction in doInSuspendedTransaction.

This commit is contained in:
Manuel Siggen 2024-08-15 09:54:46 +02:00 committed by Christian Beikov
parent 7b176df6b7
commit 4a65c51326
1 changed files with 7 additions and 3 deletions

View File

@ -114,7 +114,9 @@ public class JtaIsolationDelegate implements IsolationDelegate {
try {
// First we suspend any current JTA transaction
final Transaction surroundingTransaction = transactionManager.suspend();
LOG.debugf( "Surrounding JTA transaction suspended [%s]", surroundingTransaction );
if ( surroundingTransaction != null ) {
LOG.debugf( "Surrounding JTA transaction suspended [%s]", surroundingTransaction );
}
try {
return callable.call();
@ -124,8 +126,10 @@ public class JtaIsolationDelegate implements IsolationDelegate {
}
finally {
try {
transactionManager.resume( surroundingTransaction );
LOG.debugf( "Surrounding JTA transaction resumed [%s]", surroundingTransaction );
if ( surroundingTransaction != null ) {
transactionManager.resume( surroundingTransaction );
LOG.debugf( "Surrounding JTA transaction resumed [%s]", surroundingTransaction );
}
}
catch ( Throwable t2 ) {
// if the actually work had an error use that, otherwise error based on t