HHH-11965 - Fix cascade of one-to-one associations with proxies.

This commit is contained in:
Chris Cranford 2017-09-29 16:47:14 -04:00
parent 5a49cdc3ce
commit 00492a3707
1 changed files with 9 additions and 0 deletions

View File

@ -285,6 +285,15 @@ public final class Cascade {
// useful for @OneToOne defined as FetchType.LAZY
loadedValue = eventSource.getPersistenceContext().unproxyAndReassociate( loadedValue );
valueEntry = eventSource.getPersistenceContext().getEntry( loadedValue );
// HHH-11965
// Should the unwrapped proxy value be equal via reference to the entity's property value
// provided by the 'child' variable, we should not trigger the orphan removal of the
// associated one-to-one.
if ( child == loadedValue ) {
// do nothing
return;
}
}
if ( valueEntry != null ) {