mirror of
https://github.com/apache/openjpa.git
synced 2025-02-22 01:55:29 +00:00
OPENJPA-368 -- putting Vikram's patch in 1.0.x. 'svn merge -c 581443 ../../trunk'
git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.0.x@581444 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4cc061e5dc
commit
cc2b032223
@ -45,7 +45,7 @@ public abstract class AbstractJDBCSeq
|
||||
|
||||
protected int type = TYPE_DEFAULT;
|
||||
protected Object current = null;
|
||||
private transient Transaction _outerTransaction;
|
||||
private static ThreadLocal _outerTransaction = new ThreadLocal();
|
||||
|
||||
/**
|
||||
* Records the sequence type.
|
||||
@ -155,7 +155,7 @@ public abstract class AbstractJDBCSeq
|
||||
try {
|
||||
TransactionManager tm = getConfiguration()
|
||||
.getManagedRuntimeInstance().getTransactionManager();
|
||||
_outerTransaction = tm.suspend();
|
||||
_outerTransaction.set(tm.suspend());
|
||||
tm.begin();
|
||||
return store.getConnection();
|
||||
} catch (Exception e) {
|
||||
@ -188,13 +188,14 @@ public abstract class AbstractJDBCSeq
|
||||
tm.commit();
|
||||
try { conn.close(); } catch (SQLException se) {}
|
||||
|
||||
if (_outerTransaction != null)
|
||||
tm.resume(_outerTransaction);
|
||||
Transaction outerTxn = (Transaction)_outerTransaction.get();
|
||||
if (outerTxn != null)
|
||||
tm.resume(outerTxn);
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new StoreException(e);
|
||||
} finally {
|
||||
_outerTransaction = null;
|
||||
_outerTransaction.set(null);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user