| 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?
|