File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sequence increment does not match its pre-allocation size.

 
Amit Goda
Ranch Hand
Posts: 37
Eclipse IDE Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
James Sutherland
Ranch Hand
Posts: 553
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
Amit Goda
Ranch Hand
Posts: 37
Eclipse IDE Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 553
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 37
Eclipse IDE Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic