I want to create a primary composite key
and use an @Id
field from a parent class. But it does not work. Why?
@MappedSuperclass
static abstract class SuperEntity {
@Id
private Long id;
}
@Entity
@IdClass(SuperPK.class)
public static class ChildEntity extends SuperEntity {
@Id
private String lang;
}
public class SuperPK {
public SuperPK(Long id, String lang) {
//...
}
}
Result: Property of @IdClass not found in entity ChildEntity: id