permaculture playing cards*
The moose likes JDBC and the fly likes MySQL  + Eclipselink - SEQUENCE table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MySQL  + Eclipselink - SEQUENCE table" Watch "MySQL  + Eclipselink - SEQUENCE table" New topic
Author

MySQL + Eclipselink - SEQUENCE table

Santiago Bravo
Ranch Hand

Joined: Jul 25, 2008
Posts: 226
Hi All,

Im using MySQL with Eclipselink for an application im writing. I have a question about the SEQUENCE tabe. Why does it increment the SEQ_GEN value by 50 every time i insert a row into the DB?

For example, i insert a row into the table from my application and its assigned an id of 1. Then the nextime i insert a new row it gets the value of 51.

Is there any way to control this so that its not jumping by 50 everytime?

Thanks

S.


Santiago
My Path to SCJP Certification My Path to SCWCD Certification
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 443
Please check the value of AUTO_INCREMENT defined in the MySQL table definition. I think the value of AUTO_INCREMENT is 50 in your case. This will cause the auto increment by 50 every time you request primary key generation.
Santiago Bravo
Ranch Hand

Joined: Jul 25, 2008
Posts: 226
Deepak Pant wrote:Please check the value of AUTO_INCREMENT defined in the MySQL table definition. I think the value of AUTO_INCREMENT is 50 in your case. This will cause the auto increment by 50 every time you request primary key generation.



Thanks for your reply Deepak. I had to create a sequence table manually using the following code:




In the table that i am inserting rows, i already had the primary key with the AUTO_INCREMENT definition.

How can i change the count to increment by 1 rather than add another 50 to the count?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MySQL + Eclipselink - SEQUENCE table