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.