JPA ids auto_increment generation
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
精彩评论