|When implementing custom sequence, getGeneratedVector is executed twice in JTA environment [message #1017101]
||Sat, 09 March 2013 09:49
| Jon Miran
Registered: March 2013
I am using eclipselink with postgresql in my web application. I wrote a sql function in my database in order to generate a specific sequence.
I implement a custom sequence by inherting the org.eclipse.persistence.sequencing.Sequence. I refered to the sample in http://wiki.eclipse.org/EclipseLink/Examples/JPA/CustomSequencing. But instead of using the getGeneratedValue() method I used the getGeneratedVector() and i set the allocation size to 1.
When the method getGeneratedVector() is executed i try to call the function in my database that returns the generated sequence value.
The problem is that when transaction type is JTA, the method getGeneratedVector() is executed twice: the first time when the entityManager.persist() is called and the second time when then transcation.commit is called. This porblem made a gab in my sequence.
I will be happy for any help in order to avoid calling twice to generate the value.
Powered by FUDForum
. Page generated in 0.02909 seconds