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.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@965663 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Fay Wang 2010-07-19 22:31:41 +00:00
parent 9225c60a74
commit 1916e1bd86

View File

@ -59,7 +59,7 @@ public class TestNativeSeqGenerator extends SQLListenerTestCase {
em.getTransaction().commit(); em.getTransaction().commit();
int genId = entityE2.getId(); int genId = entityE2.getId();
int nextId = (int)((Long)em.getIdGenerator(EntityE2.class).next()).longValue(); 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(); em.close();
} }
} }