What happens if hibernate_sequences table is accidentally reset?
I am using hibernate with ID annotations:
@Id
@Column(name = "ID", nullable = false)
@GeneratedValue(strategy = GenerationType.TABLE)
For some reason the hibernate_sequences table, which is managed by hibernate, has been reset. ie. Newly inserted entities have IDs (numbers) less than older entities. Is this normal?开发者_如何学Python Won't there be constraint violations when the sequence value goes up to where it was before it was reset?
If yes, how can I manually edit the hibernate_sequences table to stop this? Is it as simple as looking up the largest id for each table and setting that as the sequence_next_hi_value value?
Thanks.
精彩评论