Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] re moving master-detail relation

You can use @PrivateOwned with existing tables.

If you call remove() though, it should get removed.  Do you have another
object that has a relationship to it that has cascade persist?  This could
get it to be re-persisted.  Ensure that you remove all references to the
object before removing it.



sdt_dev wrote:
> 
> I read through a previous discussion on the correct way to remove a
> master-detail relationship using EclipseLink.
> 
> Product {
>  List<Characteristic> characteristics;
> List<ImageInfo>imageInfos
>  }
> Characteristic{
> Color color ;
>  }
> 
> I am reusing the example , I am doing something like this to remove a
> 'characteristics' and its colors.
> product.getCharacteristics( ).remove(characteristics);
> entityManager.remove(characteristics);
> 
> and I am expecting the corresponding entry of 'characteristics' and color
> be
> removed from the db.
> For me this works for some of the ids of 'characteristics' and dosent work
> for higher value of ids. Meaning it sets the foreign_key Product_id to
> null
> in characteristics tables but does not remove the relevant row from
> characteristic table in some cases. And I also checked that this
> characteristic table entry is not used/referenced in any other table. But
> as
> suggested below that sometimes the ORM is not complete and the obejct
> could
> relate to any other db object.
> 
> Going with the below suggestion I want to use @PrivateOwned so that
> orphans
> are removed . Now in my case tables are already existing , Can I just add
> the @PrivateOwned annotation and expect it to work ? or what will Ineed to
> do make @PrivateOwned relation to take into effect for that OneToMany
> relation of characteristics in Product entity.
> 
> Appreciate any help/pointers towards this... Thanks!
> 
> 
> 
> 


-----
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
Blog:  http://java-persistence-performance.blogspot.com/ Java Persistence
Performance 
-- 
View this message in context: http://old.nabble.com/removing-master-detail-relation-tp30632438p30654344.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top