Skip to content

Commit

Permalink
HHH-12592 - Fix merging detached enhanced entities with orphan-remova…
Browse files Browse the repository at this point in the history
…l collections.

(cherry picked from commit 4f11910)
  • Loading branch information
Naros committed May 24, 2018
1 parent 1527191 commit 152a8b3
Showing 1 changed file with 9 additions and 4 deletions.
Expand Up @@ -687,10 +687,15 @@ public Object replace(

// for a null target, or a target which is the same as the original, we
// need to put the merged elements in a new collection
Object result = ( target == null ||
target == original ||
target == LazyPropertyInitializer.UNFETCHED_PROPERTY ) ?
instantiateResult( original ) : target;
Object result;
if ( target == LazyPropertyInitializer.UNFETCHED_PROPERTY ) {
result = original;
}
else {
result = ( target == null || target == original ) ?
instantiateResult( original ) :
target;
}

//for arrays, replaceElements() may return a different reference, since
//the array length might not match
Expand Down

0 comments on commit 152a8b3

Please sign in to comment.