Derived ids where the derived id is basic cannot be looked up by simple value

Description

Not sure of the exact relationship yet, but this may be related to a change I made to org.hibernate.metamodel.spi.binding.EntityIdentifier.SimpleAttributeIdentifierBindingImpl to accept any singular attribute. Before it would not accept to-one attributes. Consider this mapping (from testsuite):

Note sure what Binder was expecting here before I started my "annotation source" surgery. But atm what I build here in the "annotation source" is such that:

  • Person has a simple identifier of StringType (ssn)

  • MedicalHistory has a simple identifier of "association type" (person)

The changes to get Binder to understand this were not major. Mainly changing a few references from being typed as SingularNonAssociationAttributeBinding to SingularAttributeBinding, and then a minor change in determining where the identifier of MedicalHistory depends on another hierarchy. It all binds ok. Where it gets into trouble is in trying to load at runtime via a call like:

Aka, trying to load by the simple derived id value (Person's ssn). I remember having to specifically add code to handle this case in Persister. Looking at that code now on master I see it only kicks in when there is an IdClass for the entity. Maybe the old code (legacy AnnotationBinder stuff) wrapped this case in a "virtual composite"? Does that ring any bells?

Environment

None

Status

Assignee

Steve Ebersole

Reporter

Steve Ebersole

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure