Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

MySQL + Eclipselink - SEQUENCE table

 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic