问题
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