How to auto increment a non primary id column using Hibernate?

喜你入骨 提交于 2019-12-11 04:34:18

问题


I have kept auto increment for primary key, by using auto increment option in my Table. And I stated that using hibernate.

But now I want to auto increment a column which is not a primary key column using Hibernate Annotation. Please help. Thanks in advance.


回答1:


Use the following annotation over the specific field

@GeneratedType

private int non_Primary_field



来源:https://stackoverflow.com/questions/16350938/how-to-auto-increment-a-non-primary-id-column-using-hibernate

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