How to autoincrement an Id in a composite primary key in Hibernate?
问题 I have a table with a composite primary key - groupId and batchId . Entity class looks like: @Entity(name="EMPLOYEE") public class Employee { @EmbeddedId private EmployeePK employeePK; //Other columns and their getters and setters //Getters and setters } Composite PK: @Embeddable public class EmployeePK implements Serializable { private long groupId; private long batchId; @GeneratedValue(strategy=GenerationType.AUTO) public long getBatchId() { return batchId; } public void setBatchId(long