Hello every body I have used following code in my jpa project for working of sequence
generation,its giving exception that pre-allocation size is not set correctly,but
I have been set it correctly,interesting fact is its runing successfully and working
correctly when I am trying to run it second time and so on.please tell me the problem
why its not working first time.
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator="studentgen")
@SequenceGenerator(name="studentgen", sequenceName="myseq", allocationSize=100)
private int id;
Are you sure you have the same sequence in your DB (sequenceName=”myseq”) ?
Also, you have set the allocated size to 100, which means you have to have the step size in your sequence to be 100 as well.
Example: