PropertyAccessException with backref and <composite-map-key/>

Description

Background ~~~~~~~~~~~
Whenever you map a one-to-many association unidirectionally from the many side, with the collection-key (FK) being defined as not-null, Hibernate creates a special property (PropertyAccessor) on the related entity which is used to determine the FK value.
~~~~~~~~~~~~~~~~~~~~

Currently, this causes problems in a few scenarios if that collection is a map and a <composite-map-key/> is used instead of a simple <map-key/>.

The trivial workaround is to specify that the map keys be nullable.

The fix is to have Hibernate either:
1) not attempt to access component sub-values from when the component instance == BrackrefPropertyAccessor.UNKNOWN;
2) have BrackrefPropertyAccessor be more aggressive in terms of trying to resolve the <composite-map-key/> in the first place.

#1 is definitely the way to go in terms of performance. But it might mean needing to do that check in a few different places...

Environment

None

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

Minor
Configure