You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by fa...@apache.org on 2010/07/20 00:31:41 UTC

svn commit: r965663 - /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestNativeSeqGenerator.java

Author: faywang
Date: Mon Jul 19 22:31:41 2010
New Revision: 965663

URL: http://svn.apache.org/viewvc?rev=965663&view=rev
Log:
OPENJPA-1726: fix test case problem for Postgres. Postgres returns nextval depending on whether the two consecutive calls to nextval are in the same session or not. If they are in different sessions, the nextval returned by Postgres will be the next sequence number preallocated and stored in memory for the current session. The second nextval is not necessarily the first nextval + increment.  

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestNativeSeqGenerator.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestNativeSeqGenerator.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestNativeSeqGenerator.java?rev=965663&r1=965662&r2=965663&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestNativeSeqGenerator.java (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/generationtype/TestNativeSeqGenerator.java Mon Jul 19 22:31:41 2010
@@ -59,7 +59,7 @@ public class TestNativeSeqGenerator exte
         em.getTransaction().commit();
         int genId = entityE2.getId();        
         int nextId = (int)((Long)em.getIdGenerator(EntityE2.class).next()).longValue();
-        assertTrue("Next value should depend on previous genid", nextId == genId + 1);
+        assertTrue("Next value should depend on previous genid", nextId >= genId + 1);
         em.close();
     }
 }