OPENJPA-368. Committing Vikram's patch.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@581443 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2007-10-03 00:15:12 +00:00
parent fab1a92046
commit 5ef181ab94

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 {