Hibernate generating two different sequence Ids for PostgreSQL insert

不想你离开。 提交于 2019-12-03 16:05:42
araqnid

Looks like if you use GenerationType.SEQUENCE, you need to be specifying an "increment value" of 1 to avoid it using the sequence as a Hi/Lo seed.

The first answer (the useful one) to the question you posted explains that you need to specify "allocationSize=1" in the @GeneratedValue annotation.

On newer Hibernate releases you can instead set hibernate.id.new_generator_mappings=true in your Hibernate properties; see the docs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!