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:
Patrick Linskey 2007-10-03 00:18:37 +00:00
parent 4cc061e5dc
commit cc2b032223

View File

@ -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 {