开发者

JPA ids auto_increment generation

开发者 https://www.devze.com 2023-01-28 04:39 出处:网络
Am using JPA into my application and then the when insert different objects the database use sequential ids.

Am using JPA into my application and then the when insert different objects the database use sequential ids.

For Example:

If i have table member and table user , when inserting object of ty开发者_开发知识库pe user will take id = 1 then add object into table member will take id = 2 .

The problem is : i imported a .sql file into the database.

Then when i insert a new record from my application it cause an exception because it use ids already added.

How can i solve this problem ?


You can set the start value for AUTO_INCREMENT as

ALTER TABLE tbl AUTO_INCREMENT = 100;

See also:

  • 3.6.9. Using AUTO_INCREMENT
0

精彩评论

暂无评论...
验证码 换一张
取 消