Collection is not recreated when a property referenced as property-ref changes

Description

I have an entity mapped using hibernate.xml:

When I do

it seems that the collection is re-created only during the second flush.

During the first flush, in Collections.processReachableCollection(), CollectionEntry.currentKey is set to the name from loaded state, and therefore later in prepareCollectionForUpdate() the ownerChanged is false. During the second flush, the CollectionEntry.currentKey is updated to the changed name, and ownerChanged == true forces collection initialization and recreate.

Environment

None

Assignee

Gail Badner

Reporter

Radim Vansa

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure