|
|
|
|
|
|
Re: Does deleting a relationsip remove the dependant object from the database? [message #654619 is a reply to message #654561] |
Wed, 16 February 2011 14:00 |
Chris Delahunt Messages: 1389 Registered: July 2009 |
Senior Member |
|
|
Hello Tony,
Yes, OrphanRemoval will result in PhoneNumbers being deleted from the database when they are no longer referenced from Person. The code in the first post should work, and there is no need to call p.setTelephoneNumberCollection(lst) as you are manipulating the collection already. EntityManager.remove(t) should not be needed - be sure that nothing else references t though, and especially not with a cascade persist/merge relationship, as this will leave your cache inconsistent with the database and potentially cause the object to be resurected later on.
What Tom mentioned is correct when OrphanRemoval or PrivateOwnership (native EclpseLink) is not used.
Best Regards,
Chris
[Updated on: Wed, 16 February 2011 14:03] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03980 seconds