Ali
Ali

Reputation: 115

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 type 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 ?

Upvotes: 0

Views: 552

Answers (1)

axtavt
axtavt

Reputation: 242786

You can set the start value for AUTO_INCREMENT as

ALTER TABLE tbl AUTO_INCREMENT = 100;

See also:

Upvotes: 1

Related Questions