Re: Delete cascade?
Re: Delete cascade?
- Subject: Re: Delete cascade?
- From: Peter Vandoros <email@hidden>
- Date: Mon, 19 Mar 2007 17:52:43 +1100
Hi Ian,
No that is what is meant to happen.
WO needs to bring in the EO's into memory (if they aren't already
there) to process all delete rules including cascade, nullify, etc. It
deletes each EO as it processes the delete rule in one operation. It
queues up all the "delete" operations and executes them on commit (ie.
saveChanges()). That is why you see the cascade delete execute multiple
delete statements.
Now, if you want to bypass that behaviour, you can look at Project
Wonder. I believe it has a delete qualifier that generates the SQL you
are looking for. Just remember to let WO know about these deletes and
to not disobey the EOF Commandments.
I suggest you do some reading on this site
http://en.wikibooks.org/wiki/Programming:WebObjects for a lot of good
info.
Regards
Peter
Ian Joyner wrote:
Hi Peter,
What you say makes sense. Maybe, because my dependent entity does not
have any further cascades, I'm not seeing anything else being brought
into memory (maybe it's already there).
I think what I would expect is to see is:
SELECT * FROM <owned_table> WHERE OWNER_KEY = <PRIMARY_KEY of
owner>
<processing of any cascades from those records>
DELETE FROM <owned_table> WHERE OWNER_KEY = <PRIMARY_KEY of
owner>
However, all I see is the DELETEs a single one at a time. Maybe I just
have an simple case?
Thanks
Ian
On 19/03/2007, at 2:08 PM, Peter Vandoros wrote:
Hi Ian,
WebObjects does this because it needs to bring all the EO's into memory
to process the delete rules specified in your EOModel.
Regards
Peter
Ian Joyner wrote:
I just noticed in my system that if I have
the cascade delete rule set on a to-many relationship in EOModeler that
the deletes happen one by one.
That is if I have a master record with three detail records, WO issues
three SQL DELETEs.
The setup is, each record has a primary key PRIMARY_KEY, which relates
to the owned records which have OWNER_KEY. To do the delete cascade, I
would think that DELETE FROM <owned table> WHERE OWNER_KEY =
<PRIMARY_KEY of owner> would suffice.
Have I got something set up wrong here, or am I missing something?
Thanks
Ian Joyner
Sportstec
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
--Peter Vandoros
Software Engineer
Etech Group Pty Ltd
Level 3/21 Victoria St
Melbourne VIC 3000
Australia
Ph: +61 3 9639 9677
Fax: +61 3 9639 9577
----------------------------------
IMPORTANT: This e-mail message and any attachments are confidential and
may be privileged. If received in error, please reply to this message
and destroy all copies and any attachments. You should check this
message and any attachments for viruses or defects. Our liability is
limited to resupplying any affected message or attachments. For more
information about Etech Group, please visit us at
http://www.etechgroup.com.au.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
--This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
--
Peter Vandoros
Software Engineer
Etech Group Pty Ltd
Level 3/21 Victoria St
Melbourne VIC 3000
Australia
Ph: +61 3 9639 9677
Fax: +61 3 9639 9577
----------------------------------
IMPORTANT: This e-mail message and any attachments are confidential and
may be privileged. If received in error, please reply to this message
and destroy all copies and any attachments. You should check this
message and any attachments for viruses or defects. Our liability is
limited to resupplying any affected message or attachments. For more
information about Etech Group, please visit us at
http://www.etechgroup.com.au.
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden