openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r1292034 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachLite.java
Date Tue, 21 Feb 2012 21:14:58 GMT
Author: curtisr7
Date: Tue Feb 21 21:14:57 2012
New Revision: 1292034

URL: http://svn.apache.org/viewvc?rev=1292034&view=rev
Log:
OPENJPA-2136: Fix NPE when using LiteAutoDetach.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachLite.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java?rev=1292034&r1=1292033&r2=1292034&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java Tue
Feb 21 21:14:57 2012
@@ -3457,6 +3457,9 @@ public class BrokerImpl
         if (_transAdditions != null) {
             _transAdditions.clear();
         }
+        if (_pending != null) {
+            _pending = null;
+        }
         if (_dmLite == null) {
             _dmLite = new DetachManagerLite(_conf);
         }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachLite.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachLite.java?rev=1292034&r1=1292033&r2=1292034&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachLite.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/detachment/TestDetachLite.java
Tue Feb 21 21:14:57 2012
@@ -45,6 +45,16 @@ public class TestDetachLite extends Test
         root = createData();
     }
 
+    public void testPendingClear() {
+        EntityManager em = emf.createEntityManager();
+        DMCustomer dm = em.find(DMCustomer.class, root.getId());
+        dm.setLastName(System.currentTimeMillis() + "--last");
+        em.clear();
+        em.getTransaction().begin();
+        // Pre OPENJPA-2136 this commit call would fail.
+        em.getTransaction().commit();
+    }
+
     public void testLeaveProxy() {
         Object[] p = props;
         p[1] = "loaded(LiteAutoDetach=true,DetachProxyFields=false)";



Mime
View raw message