Hibernate fails when mapping one-to-many collections by non-primary key

Description

Hibernate fails when mapping a one-to-many collection by a field that is not the primary key.

For example, if we have:

Class Parent: Long id, Long collectionKey

Class Child: Long id, Parent parent (key-column of collectionKey)

Hibernate allows this construct using property-ref, and can instantiate objects into the collection, but cannot retrieve them on subsequent connections or once evicted from cache.

Activity

Vlad MihalceaJune 26, 2018 at 9:40 AM

Applied PR upstream.

Peter HolvenstotJune 12, 2018 at 4:18 PM

Created PR #2344

Fixed

Details

Assignee

Reporter

Fix versions

Priority

Created June 12, 2018 at 4:10 PM
Updated February 24, 2025 at 9:40 AM
Resolved June 26, 2018 at 9:40 AM