This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: MySQL + Eclipselink - SEQUENCE table
 
Similar Threads
Jpa/mysql issue
sequence creation
Returning a sequence id
MySQL error
duplicate created in AUTO INCREMENT in mysql if its possible?