Pinaki Poddar wrote:
> 
> Hi, 
> 
> Address address = person.getAddresses().iterator().next(); 
> person.getAddresses().remove(address); 
> address.setPerson(null);
> 
> Generally speaking, in JPA world, nulling a relation or removing an
> element from a collection do not imply that the corresponding database
> record is deleted. To delete records from database, em.remove() needs to
> be invoked.
> 
> However, delete-orphan behavior that your example code implies is
> supported by OpenJPA with @Dependent/@ElementDependent annotation on a
> relation. 
> 

Please note that I was referring to the join-table, not the "entity"-tables.
I consider nullifying one side of the join-table not to be efficient for
dissolving a relationship. It will probably do no harm, but the join-table
will gradually be messed up with these "half-null"-tupels. 

If you enforce integrity so that the Address_Phone id has to be unique in
the join-table (otherwise it would be a many-to-many relationship type), you
will never be able to establish new Person-Address connection with that
particular address object.

-- Frank



-- 
View this message in context: 
http://n2.nabble.com/bidirectional-one-to-many-relationship-with-join-table-tp678479p685702.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Reply via email to