HHH-14319 Create new collection rather than clearing original which is backing PersistentCollection entry of session
This commit is contained in:
parent
966d07c2d1
commit
a975fbf5d4
|
@ -742,7 +742,8 @@ public abstract class CollectionType extends AbstractType implements Association
|
|||
// need to put the merged elements in a new collection
|
||||
Object result = ( target == null ||
|
||||
target == original ||
|
||||
target == LazyPropertyInitializer.UNFETCHED_PROPERTY ) ?
|
||||
target == LazyPropertyInitializer.UNFETCHED_PROPERTY ||
|
||||
target instanceof PersistentCollection && ( (PersistentCollection) target ).isWrapper( original ) ) ?
|
||||
instantiateResult( original ) : target;
|
||||
|
||||
//for arrays, replaceElements() may return a different reference, since
|
||||
|
|
|
@ -143,7 +143,7 @@ public class UpdateDetachedTest extends BaseCoreFunctionalTestCase{
|
|||
@Test
|
||||
@TestForIssue(jiraKey = "HHH-14319")
|
||||
public void testUpdateDetachedWithAttachedPersistentSet() {
|
||||
final Bar bar = new Bar( 4, "Bar" );
|
||||
final Bar bar = new Bar( 5, "Bar" );
|
||||
final Set<Comment> comments = new HashSet<>();
|
||||
comments.add( new Comment( "abc", "me" ) );
|
||||
bar.comments = comments;
|
||||
|
|
Loading…
Reference in New Issue