get sequence number through Eclipselink [message #998157] |
Wed, 09 January 2013 08:09  |
Eclipse User |
|
|
|
Hi,
I have read the wiki so i know that for getting a sequence value i should be able to do this
long id = em.unwrap(Session.class).getNextSequenceNumberValue(Employee.class).longValue();
However when i try this i get a NPE
Caused by: java.lang.NullPointerException: null
at org.eclipse.persistence.internal.sequencing.SequencingManager.getNextValue(SequencingManager.java:1067) ~[eclipselink-2.4.1.jar:2.4.1.v20121003-ad44345]
at org.eclipse.persistence.internal.sequencing.SequencingManager.getNextValue(SequencingManager.java:266) ~[eclipselink-2.4.1.jar:2.4.1.v20121003-ad44345]
at org.eclipse.persistence.internal.sessions.AbstractSession.getNextSequenceNumberValue(AbstractSession.java:2457) ~[eclipselink-2.4.1.jar:2.4.1.v20121003-ad44345]
Our sequence is just defined like this
@SequenceGenerator(name = "AppId", sequenceName = "SEQ_APP", allocationSize = 500)
Reason i'm asking is that we have mixed jpa en jdbc inserts and i would like them to pull numbers from the same sequence number pool, otherwise the jdbc inserts will have ids that are 500 apart each time which is not desired.
Any thoughts ?
Jorg
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.19120 seconds