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!

----- James Sutherland
 EclipseLink ,
Wiki: EclipseLink , TopLink 
Forums: TopLink , EclipseLink 
Book: Java Persistence 
Blog: Java Persistence
View this message in context:
Sent from the EclipseLink - Users mailing list archive at

Back to the top