[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] relationships must be severed after merge for remove to function properly?
|
Hello Mike,
If you are making changes that affect A, you should also be merging
those changes as well. Since the relation from B to A has been severed,
any changes to A would not be picked even if the relationship was marked
cascade all. So removing B will cause A to still have a reference to B
in the cache.
Best Regards,
Chris
Mike Traum wrote:
I have the following enitiy map:
A->B->C (where -> represents a OneToMany relationship)
If I want to remove a B, I sever the relationship between A and B. If
I do this before the EntityManager.merge, merge returns a B object
with no relationship to A. However, if I remove that returned B, it
will be deleted from the database but not the cache, just as if the
relationship had not been severed.
But, if I sever the relationship on the B returned from merge and then
do the remove, all is fine (deleted from database and cache).
Is this expected behavior? It seems to me that you should be able to
sever the relationship before the merge, as merge is supposed to copy
the state of the object. But, maybe the issue here is that the state
of B is copied, but not of A, therefore A still contains the
relationship to B and B is not removed from the cache. I have a
cascade=ALL on all of the OneToMany relationships, but not on the
related ManyToOne's. Should I be cascading the other direction also?
Thanks,
Mike
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users