|
Hibernate fails with the case documented as Example 5 in Section 2.4.1.3 (Examples of Derived Identities) in the JPA 2.1 specification.
The parent entity uses IdClass. The dependent's primary key class is of same type as that of the parent entity.
Reproduce as follows (Maven project attached). The test fails with Hibernate 4.3.0 but passes with EclipseLink 2.5.1.
public class PersonId implements Serializable {
String firstName;
String lastName;
}
@Entity
@IdClass(PersonId.class)
public class Person {
@Id String firstName;
@Id String lastName;
}
@Entity
@IdClass(PersonId.class)
public class MedicalHistory {
@Id @OneToOne Person patient;
String foobar;
}
It probably does not make a difference, but the database I was using this with was PostgreSQL.
|