Skip to main content

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 Friend
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

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 DelahuntFriend
Messages: 1382
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,
Previous Topic:Maven static weaving plugin
Next Topic:Stuck with Moxy getting started example
Goto Forum:

Current Time: Mon Apr 12 23:16:17 GMT 2021

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

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

Back to the top