Re: one-to-many relationship question
Re: one-to-many relationship question
- Subject: Re: one-to-many relationship question
- From: "Cheong Hee (Gmail)" <email@hidden>
- Date: Fri, 09 Sep 2011 13:47:48 +0800
This is what being described in the documentation:
Owns Destination
You can set a source object as owning its destination objects. When a
source object owns its destination objects and you remove a destination
object from the source object's relationship array, you're also deleting it
from the database (alternatively, you can transfer it to a new owner). This
is because ownership implies that the owned object can't exist without an
owner-for example, line items can't exist outside of a purchase order.
By contrast, you might have a department object that doesn't own its
employee objects. If you remove an employee from a department's
employees array, the employee continues to exist in the database, but
its department variable is set to null (or nil in Objective-C). If you
really
intend to delete the employee from the database, you'd have to do it
explicitly.
From what it said, I think it is quite clear that the destination object
will only be removed from database if owns destination is set in source
object. Else you will have to do it explicitely from the code.
Whereas cascade delete will remove from top-down. Delete source object will
delete the destination objects altogether.
Cheers
Cheong Hee
----- Original Message -----
From: "Paul D Yu" <email@hidden>
To: "Michael Gargano" <email@hidden>
Cc: "WebObjects webobjects-dev" <email@hidden>
Sent: Friday, September 09, 2011 3:03 AM
Subject: Re: one-to-many relationship question
This is what I know.
Owns destination on a toOne relationship means every time a master record
is created, a "child" record will also be created. The primary key of the
child will be set to the primary key of the master.
Cascade delete means when you delete the master record, the child
record(s) will automatically be deleted as well.
Paul
On Sep 8, 2011, at 2:59 PM, Michael Gargano wrote:
Hi all,
Quick question, does delete on cascade imply owns destination? Also,
does checking owns destination force the insertion of the destination
objects after the insertion of the source entity?
I think David LeBer answered this for me once, but I forgot.
Thanks.
-Mike
_______________________________________________
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
_______________________________________________
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