openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r581444 - /openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java
Date Wed, 03 Oct 2007 00:18:38 GMT
Author: pcl
Date: Tue Oct  2 17:18:37 2007
New Revision: 581444

URL: http://svn.apache.org/viewvc?rev=581444&view=rev
Log:
OPENJPA-368 -- putting Vikram's patch in 1.0.x. 'svn merge -c 581443 ../../trunk'

Modified:
    openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java

Modified: openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java?rev=581444&r1=581443&r2=581444&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java
(original)
+++ openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/AbstractJDBCSeq.java
Tue Oct  2 17:18:37 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