[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[eclipselink-users] relationships must be severed after merge for remove to function properly?
|
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