openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r1231375 - in /openjpa/trunk: openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSimple.java
Date Fri, 13 Jan 2012 22:59:34 GMT
Author: curtisr7
Date: Fri Jan 13 22:59:33 2012
New Revision: 1231375

URL: http://svn.apache.org/viewvc?rev=1231375&view=rev
Log:
OPENJPA-2107: Only reset Broker.flushed flag if initializing a new Statemanager.

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/query/TestSimple.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=1231375&r1=1231374&r2=1231375&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 Fri
Jan 13 22:59:33 2012
@@ -4110,10 +4110,11 @@ public class BrokerImpl
         lock();
         try {
             switch (status) {
-                case STATUS_INIT:                	
-                	if (_compat.getResetFlushFlagForCascadePersist()){//OPENJPA-2051       
        	
-                		_flags &= ~FLAG_FLUSHED;
-                	}
+                case STATUS_INIT:
+                    // Only reset the flushed flag is this is a new instance.
+                    if (sm.isNew() && _compat.getResetFlushFlagForCascadePersist())
{// OPENJPA-2051
+                        _flags &= ~FLAG_FLUSHED;
+                    }
                     _cache.add(sm);
                     break;
                 case STATUS_TRANSIENT:

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSimple.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSimple.java?rev=1231375&r1=1231374&r2=1231375&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSimple.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSimple.java
Fri Jan 13 22:59:33 2012
@@ -51,12 +51,16 @@ public class TestSimple extends BaseQuer
         {
             EntityManager em = currentEntityManager();
             startTx(em);
-            List l = em.createQuery("SELECT o FROM Entity1 o "
-                + "WHERE o.stringField = 'testSimple'").getResultList();
-            assertSize(1, l);
-            endTx(em);
+            em.persist(new Entity1(1, "testSimple", 12));
+            List<Entity1> l =
+                em.createQuery("SELECT o FROM Entity1 o " + "WHERE o.stringField = 'testSimple'",
Entity1.class)
+                    .getResultList();
+            assertSize(2, l);
+            rollbackTx(em);
+            em.clear();
             endEm(em);
         }
+        
 
         // test Update
         {



Mime
View raw message