mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
#3109 JtaTransactionManager - fix getCurrentTransaction()
Fix for JtaTransactionManager to allow Wildfly (or other) to throw an Exception when TransactionSynchronizationRegistry.getResource() is called.
This commit is contained in:
+9
-4
@@ -79,10 +79,15 @@ public final class JtaTransactionManager implements ExternalTransactionManager {
|
||||
@Override
|
||||
public Object getCurrentTransaction() {
|
||||
TransactionSynchronizationRegistry syncRegistry = getSyncRegistry();
|
||||
SpiTransaction t = (SpiTransaction) syncRegistry.getResource(EBEAN_TXN_RESOURCE);
|
||||
if (t != null) {
|
||||
// we have already seen this transaction
|
||||
return t;
|
||||
try {
|
||||
SpiTransaction t = (SpiTransaction) syncRegistry.getResource(EBEAN_TXN_RESOURCE);
|
||||
if (t != null) {
|
||||
// we have already seen this transaction
|
||||
return t;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// deem that there is no current transaction
|
||||
return null;
|
||||
}
|
||||
|
||||
// check current Ebean transaction
|
||||
|
||||
Reference in New Issue
Block a user