Hibernate is generating auto increment alternating id for tables

☆樱花仙子☆ 提交于 2019-12-01 14:15:16

You haven't specified any generator for any of your entities. So Hibernate uses the default one for your database, which consists in using single sequence: hibernate_sequence, to generate the IDs of the entities.

Annotate your Student id field with something like

@SequenceGenerator(name = "studentGenerator", sequenceName = "STUDENT_SEQUENCE", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "studentGenerator")

and it will use a dedicated sequence, STUDENT_SEQUENCE, for the Student entity. Do the same (with a different generator and sequence name) for the other entities.

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