After truncating my database and re-insert it with script my spring doesn't refer to the latest data anymore. But somehow when I create new user, the hibernate still create user id as 1, which in fact already existed after I committed my script. Refreshing or restarting project won't help. Any ideas ? Thanks
CodePudding user response:
Databases like oracle maintain the sequence buffer for the primary key, you will have to set your sequence number in the sequence table then it will start generating the primary key to the next number in the sequence.
In Postgres also you can do the same and this will solve your problem.