HHH-12592 - Fix merging detached enhanced entities with orphan-removal collections.
This commit is contained in:
parent
e7b338a109
commit
4f119105f8
|
@ -689,10 +689,15 @@ public abstract class CollectionType extends AbstractType implements Association
|
|||
|
||||
// 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
|
||||
|
|
Loading…
Reference in New Issue