Using enum as id
问题 Using JPA, can we define an enum as id of an entity? I've tried the following: public enum AssetType { .... } @Entity @IdClass(AssetType.class) public class Adkeys { private AssetType type; @Id @Enumerated(EnumType.STRING) @Column(nullable = false) public AssetType getType() { return type; } } Using OpenJPA, it complains: org.apache.openjpa.persistence.ArgumentException: The id class "class aa.AssetType" specified by type "class aa.Adkeys" does not have a public no-args constructor. So my