how to make a composite primary key (java persistence annotation)
问题 How to make it so that the table user_roles defines the two columns (userID, roleID) as a composite primary key. should be easy, just can\'t remember/find. In user entity: @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = \"user_roles\") public List<RoleDAO> getRoles() { return roles; } @Id @GeneratedValue(strategy = GenerationType.AUTO) public Integer getUserID() { return userID; } In roles entity: @ManyToMany(fetch = FetchType.LAZY) @JoinTable(name = \"user_roles\") public List<UserDAO>