开发者

What happens if hibernate_sequences table is accidentally reset?

开发者 https://www.devze.com 2022-12-12 06:30 出处:网络
I am using hibernate with ID annotations: @Id @Column(name = \"ID\", nullable = false) @GeneratedValue(strategy = GenerationType.TABLE)

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.

0

精彩评论

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