This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I m new to JPA technology. I m trying to insert a simple record to my database table, but i m getting the following exception
Caused by: Exception [EclipseLink-7027] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The sequence named [login.users_id_seq] is setup incorrectly. Its increment does not match its pre-allocation size.
Enable logging and include the SQL, and the database that you are using.
EclipseLink throws this error when the value returned from selecting the sequence minus the preallocationSize is less than or equal to zero.
Your preallocationSize is 1, so should be ok, assuming you having compiled/deployed your code correctly.
It could be an issue with the starting value, if it were starting at 0, then could become negative, try starting the sequence at 1 (or even 2).
But can anyone explain the cause of this. I found it through google search and it works fine.
Joined: Oct 01, 2007
Ah, I see, you had the wrong generator name.
The "generator" must be the "name" of the SequenceGenerator, not the name of the sequence. Because you gave the name of the sequence, and did not have a generator with that name it used the default preallocaiton which is 50.
The strategy should be SEQUENCE, but isn't required as you define the generator, it is only relevant when you don't define the generator.