Given the class below does anyone know why EclipseLink implementation of JPA fails to map them to database entities? The following error is returned:
Entity class [class com.my.entity.Y] has no primary key specified. It should define either an @Id, @EmbeddedId or an @IdClass. If you have defined PK using any of these annotations then make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy.
@Entity
@Access(AccessType.PROPERTY)
public interface Y {
void setId(Long id);
@Id
Long getId();
}
@Entity
public class Z implements Y {
long id;
@Override
public void setId(Long id) {
this.id = id;
}
@Override
public Long getId() {
return id;
}
}
Many thanks