• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: When do I use addObjectToBothSidesOfRelationshipWithKey?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: When do I use addObjectToBothSidesOfRelationshipWithKey?


  • Subject: Re: When do I use addObjectToBothSidesOfRelationshipWithKey?
  • From: Goh Keng Boon <email@hidden>
  • Date: Fri, 3 Sep 2004 10:28:34 +0800

Hi Tom,

This is what i did for mine :

suppose an Author has 1-to-many relationship to Book, you will need to use the relationship while assigning books to this author, for example :

Author anAuthor;
Book aBook;

anAuthor.addObjectToBothSidesOfRelationshipWithKey(aBook,"the_relationsh ip_that_you_defined_in_EOModeler");

In this case, the author field of book record will be filled with this particular author's PK.

Which is equivalent to :

project.addObjectToBothSidesOfRelationshipWithKey(req, "reqs");
and so on.

KB

On 03-Sep-04, at 7:00 AM, Tom Jones wrote:

The code below is my attempt to preserve the following relationships
project<-->>req
reqpriority<-->>req
status<-->>req
reqtype<-->>req

a project owns its reqs

if a reqpriority, status or reqtype is deleted, the req's
corresponding value should be null.


given that is all of this code necessary?

session.defaultEditingContext().insertObject(req);
req.reqpriority().addObjectToBothSidesOfRelationshipWithKey(req, "reqs");
req.status().addObjectToBothSidesOfRelationshipWithKey(req, "reqs");
req.reqtype().addObjectToBothSidesOfRelationshipWithKey(req, "reqs");
project.addObjectToBothSidesOfRelationshipWithKey(req,"reqs");
session.defaultEditingContext().saveChanges();


Thanks,

Tom
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >When do I use addObjectToBothSidesOfRelationshipWithKey? (From: Tom Jones <email@hidden>)

  • Prev by Date: Re: When do I use addObjectToBothSidesOfRelationshipWithKey?
  • Next by Date: Question about WOPupUpButton
  • Previous by thread: Re: When do I use addObjectToBothSidesOfRelationshipWithKey?
  • Next by thread: Question about WOPupUpButton
  • Index(es):
    • Date
    • Thread