Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Using @PrivateOwned(@PrivateOwned)
Using @PrivateOwned [message #692714] Tue, 05 July 2011 05:25 Go to next message
Pramod  is currently offline Pramod
Messages: 1
Registered: July 2011
Junior Member
I have a Query "delete from AgentGroup a" . The entity Agentgroup 1:M
relation with agents . When I execute the query above the agents dont get
deleted and I get FK constraint error. Even when i use @PrivateOwned over
the collection of agents



Thanks
P
Re: Using @PrivateOwned [message #693508 is a reply to message #692714] Wed, 06 July 2011 15:57 Go to previous message
Chris Delahunt is currently offline Chris Delahunt
Messages: 1034
Registered: July 2009
Senior Member
Delete queries only operate on the class you execute it on - so only AgentGroup entities and any subclasses will be deleted. A JPA provider does not read in the objects being deleted in these builk delete/update or native SQL queries, and so cannot determine if there are any references that need to be removed. Any references to these entities will need to be cleaned up before you execute a delete query on AgentGroup; using delete SQL for the refering entities or an update to fix the relationships.

If you want private ownership to be respected or the delete to cascade over mappings, you will need to call remove on the entity instance rather then using a delete query.

Best Regards,
Chris
Previous Topic:Maven static weaving plugin
Next Topic:Stuck with Moxy getting started example
Goto Forum:
  


Current Time: Thu Oct 23 02:29:01 GMT 2014

Powered by FUDForum. Page generated in 0.01905 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software