It is not possible to load an entity by an ID when it is mapped similar to the description of example 4 Case (a) of JPA 2.2 specification:
Loading with the following code:
MedicalHistory history = s.find( MedicalHistory.class, patient );
Hibernate incorrectly expects the ID to be of type MedicalHistory. It should expect the ID to be of type Person.
Calling #find by the primary key works fine, although I'm not sure this use case is defined by the spec:
MedicalHistory history = s.find( MedicalHistory.class, patient.getSsn() );
In addition, Querying by ID works:
"SELECT h FROM MedicalHistory h WHERE h.patient = :patient"