mirror of
https://github.com/apache/openjpa.git
synced 2025-03-01 14:09:06 +00:00
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:
parent
fab1a92046
commit
5ef181ab94
@ -45,7 +45,7 @@ public abstract class AbstractJDBCSeq
|
|||||||
|
|
||||||
protected int type = TYPE_DEFAULT;
|
protected int type = TYPE_DEFAULT;
|
||||||
protected Object current = null;
|
protected Object current = null;
|
||||||
private transient Transaction _outerTransaction;
|
private static ThreadLocal _outerTransaction = new ThreadLocal();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Records the sequence type.
|
* Records the sequence type.
|
||||||
@ -155,7 +155,7 @@ public abstract class AbstractJDBCSeq
|
|||||||
try {
|
try {
|
||||||
TransactionManager tm = getConfiguration()
|
TransactionManager tm = getConfiguration()
|
||||||
.getManagedRuntimeInstance().getTransactionManager();
|
.getManagedRuntimeInstance().getTransactionManager();
|
||||||
_outerTransaction = tm.suspend();
|
_outerTransaction.set(tm.suspend());
|
||||||
tm.begin();
|
tm.begin();
|
||||||
return store.getConnection();
|
return store.getConnection();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -188,13 +188,14 @@ public abstract class AbstractJDBCSeq
|
|||||||
tm.commit();
|
tm.commit();
|
||||||
try { conn.close(); } catch (SQLException se) {}
|
try { conn.close(); } catch (SQLException se) {}
|
||||||
|
|
||||||
if (_outerTransaction != null)
|
Transaction outerTxn = (Transaction)_outerTransaction.get();
|
||||||
tm.resume(_outerTransaction);
|
if (outerTxn != null)
|
||||||
|
tm.resume(outerTxn);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new StoreException(e);
|
throw new StoreException(e);
|
||||||
} finally {
|
} finally {
|
||||||
_outerTransaction = null;
|
_outerTransaction.set(null);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user