Hibernate Composite Key: foreign key has wrong number of columns
问题 I am new to Hibernate and JPA and am having difficulty setting up a composite key as defined below: @Entity @Table(name = Entity.TABLE) @IdClass(EntityPK.class) public class MyEntity extends Entity { @CollectionOfElements @JoinTable(name="items", joinColumns = @JoinColumn(name="items")) private List<String> items; @Id private Type type; @Id private Level level; // plus standard constructors/getters/setters } public class EntityPK implements Serializable { private Type type; private Level