openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r581443 - /openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java
Date Wed, 03 Oct 2007 00:15:12 GMT
Author: pcl
Date: Tue Oct  2 17:15:12 2007
New Revision: 581443

URL: http://svn.apache.org/viewvc?rev=581443&view=rev
Log:
OPENJPA-368. Committing Vikram's patch.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java?rev=581443&r1=581442&r2=581443&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java
Tue Oct  2 17:15:12 2007
@@ -45,7 +45,7 @@
 
     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 @@
             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 @@
                 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 {



Mime
View raw message