This content has been marked as final. Show 2 replies
Looks likely that your sequence allocation size doesn't match the sequence allocation used in the database. By default, JPA assumes a sequence allocation size of 50, were as most database sequence objects will use a size of 1. Problems will arise when they do not match - in this case it is trying to use 10 (current sequence value of 60 minus the 50 preallocation number).
add allocationSize=1 or what ever the database sequence allocation size is to the SequenceGenerator annotation.
I think you are right with your hint.
But I'm still not able to fix the problem.
The defined sequence is:
Min Value 1
Max Value 9999999999
Increment By 1
Cycle Flag N
Order Flag N
Cache Size 20
Last Number 1628
Like your suggestion, I set the allocationSize=1 in SequenceGenerator annotation.
After this the id-missmatch is not 50, it is 1. So I tried to set the allocationSize=0 but then of course the application crashes.
Okay, I found the problem. Your solution works. I should have set the allocationSize=1. The id missmatch is created by an trigger which is executed before every insert. I disabled the trigger and it works.
I'm really thankful for your help.
Edited by: 788671 on 17.08.2010 00:27