How to create hibernate composite key using annotations
问题 I am trying to use hibernate annotations to insert data to a MySQL database table which doesn't have a primary key defined. However the fact is 2 fields of that table together are unique in the table.how can i achieve the same using hibernate annotation?. here is my code.. @Entity @Table(name = "RolesMenuItems") public class RolesMenuItems { @Column(name = "RoleID") private String roleID; @Column(name = "MenuItemID") private String menuItemID; /*setter getter methods */ } 回答1: You can use