aspose file tools*
The moose likes Object Relational Mapping and the fly likes Sequence increment does not match its pre-allocation size. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Sequence increment does not match its pre-allocation size." Watch "Sequence increment does not match its pre-allocation size." New topic
Author

Sequence increment does not match its pre-allocation size.

Amit Goda
Ranch Hand

Joined: Jan 21, 2012
Posts: 37

Hello Friends,

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.


I m using eclipse link and netbeans 7.1.

My code of entity class is as follows...



ANy Help will be highly appreciated!


AMiT
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
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).

TopLink : EclipseLink : Book:Java Persistence : Blog:Java Persistence Performance
Amit Goda
Ranch Hand

Joined: Jan 21, 2012
Posts: 37

Thank You Very Much James for your reply.

Actually i forgot to say i m using postgres 9.1.

I got my problem solved by changing



to



But can anyone explain the cause of this. I found it through google search and it works fine.
James Sutherland
Ranch Hand

Joined: Oct 01, 2007
Posts: 553
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.
Amit Goda
Ranch Hand

Joined: Jan 21, 2012
Posts: 37

Once Again Thank You Very Much James.

That was a nice explanation. You've been of great help.
Thank You for your precious time.

Cheers
 
Don't get me started about those stupid light bulbs.
 
subject: Sequence increment does not match its pre-allocation size.