Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Expected merge behavior in lazycollectionfield with CascadeType.MERGE, PERSIST?

The spec. doesn't say what supposed to happen in this case.
 
I am assuming that Parent to Child is a bidirectional one to many.
The spec. says that maintaing of referential integrity is the user's responsibility - so I can't imagine what else could happen here:
the user never sets back pointers of the old children to null - so they can't be updated to null in the db.
Would I bet a farm that all providers implement it this way? No.
 
But as I said before the most safe way I can see is simply persisting the new children (with the pointer referencing the parent) - that's for sure supported by all providers in exactly the same way.
Also consider do you really need Parent to Child OneToMany relationship, may be just Child to Parent OneToOne would be enough?
----- Original Message -----
Sent: Friday, July 24, 2009 3:30 PM
Subject: Re: [eclipselink-users] Expected merge behavior in lazycollectionfield with CascadeType.MERGE, PERSIST?

On Fri, Jul 24, 2009 at 12:28 PM, Andrei Ilitchev <andrei.ilitchev@xxxxxxxxxx> wrote:
After the merge the attached parent indeed will have a new collection containing just new child,
but if you refresh the parent it will have four children - all old ones and the new one.

Actually this is good news for me.  Now, is that supposed to be the behavior?

Thanks,
Laird


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

Back to the top