openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hthom...@apache.org
Subject svn commit: r1341964 - in /openjpa/branches/2.0.x: 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 Wed, 23 May 2012 18:08:56 GMT
Author: hthomann
Date: Wed May 23 18:08:56 2012
New Revision: 1341964

URL: http://svn.apache.org/viewvc?rev=1341964&view=rev
Log:
OPENJPA-2107: Applied to 2.0.x Rick's changes from trunk (2.2.x)

Modified:
    openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
    openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSimple.java

Modified: openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java?rev=1341964&r1=1341963&r2=1341964&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
(original)
+++ openjpa/branches/2.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
Wed May 23 18:08:56 2012
@@ -4039,10 +4039,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/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSimple.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSimple.java?rev=1341964&r1=1341963&r2=1341964&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSimple.java
(original)
+++ openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/query/TestSimple.java
Wed May 23 18:08:56 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