Skip to content

Commit

Permalink
Throw SQLException if enlistResource returns false
Browse files Browse the repository at this point in the history
  • Loading branch information
graben authored and barreiro committed Oct 18, 2023
1 parent 707aa09 commit ced9e8b
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ public void associate(TransactionAware transactionAware, XAResource xaResource)
if ( transactionSynchronizationRegistry.getResource( key ) == null ) {
transactionSynchronizationRegistry.registerInterposedSynchronization( new InterposedSynchronization( transactionAware ) );
transactionSynchronizationRegistry.putResource( key, transactionAware );
transactionManager.getTransaction().enlistResource( createXaResource( transactionAware, xaResource ) );
if ( !transactionManager.getTransaction().enlistResource( createXaResource( transactionAware, xaResource ) ) ) {
throw new SQLException("Unable to enlist connection to existing transaction");
}
} else {
transactionAware.transactionStart();
}
Expand Down

0 comments on commit ced9e8b

Please sign in to comment.