cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r569668 - in /cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa: JpaTransaction.java ResourceLocalEntityManager.java
Date Sat, 25 Aug 2007 13:47:55 GMT
Author: aadamchik
Date: Sat Aug 25 06:47:54 2007
New Revision: 569668

URL: http://svn.apache.org/viewvc?rev=569668&view=rev
Log:
CAY-853 JPA EntityTransaction must allow multiple begin/commit cycles

Modified:
    cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/JpaTransaction.java
    cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/ResourceLocalEntityManager.java

Modified: cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/JpaTransaction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/JpaTransaction.java?rev=569668&r1=569667&r2=569668&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/JpaTransaction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/JpaTransaction.java
Sat Aug 25 06:47:54 2007
@@ -37,9 +37,16 @@
     protected Transaction transaction;
     protected boolean rollbackOnly;
 
-    public JpaTransaction(Transaction transaction, EntityManager entityManager) {
+    public JpaTransaction(EntityManager entityManager) {
         this.entityManager = entityManager;
-        this.transaction = transaction;
+        reset();
+    }
+    
+    /**
+     * Creates a new internal Cayenne transaction.
+     */
+    protected void reset() {
+        this.transaction = Transaction.internalTransaction(null);
     }
 
     /**
@@ -76,6 +83,8 @@
         catch (CayenneException e) {
             throw new PersistenceException(e.getMessage(), e);
         }
+        
+        reset();
     }
 
     /**
@@ -98,6 +107,8 @@
         catch (CayenneException e) {
             throw new PersistenceException(e.getMessage(), e);
         }
+        
+        reset();
     }
 
     /**

Modified: cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/ResourceLocalEntityManager.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/ResourceLocalEntityManager.java?rev=569668&r1=569667&r2=569668&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/ResourceLocalEntityManager.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jpa-unpublished/src/main/java/org/apache/cayenne/jpa/ResourceLocalEntityManager.java
Sat Aug 25 06:47:54 2007
@@ -33,7 +33,6 @@
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.PersistenceState;
 import org.apache.cayenne.Persistent;
-import org.apache.cayenne.access.Transaction;
 import org.apache.cayenne.query.EJBQLQuery;
 
 public class ResourceLocalEntityManager implements EntityManager, CayenneEntityManager {
@@ -348,9 +347,7 @@
      */
     public EntityTransaction getTransaction() { // note - allowed to be called on a closed
         if (transaction == null) {
-            this.transaction = new JpaTransaction(
-                    Transaction.internalTransaction(null),
-                    this);
+            this.transaction = new JpaTransaction(this);
         }
 
         return transaction;



Mime
View raw message