• 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: EO: Should I create primary keys?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EO: Should I create primary keys?


  • Subject: Re: EO: Should I create primary keys?
  • From: Denis Stanton <email@hidden>
  • Date: Wed, 30 Jul 2003 09:56:59 +1200

Excellent. Thank you very much Art for setting this out. I was aware of addObjectToBothSidesOfRelationshipWithKey but I wasn't confident of the parameter definition so I have stuck with what I know works. You have moved me on a step.

Denis

On Tuesday, July 29, 2003, at 07:34  PM, Art Isbell wrote:

On Monday, July 28, 2003, at 05:42  PM, Denis Stanton wrote:

type.addToVehicles(newVehicle); // adds the vehicle to the
array of vehicles for this type
newVehicle.setType(type); // sets the foreign key in my Vehicle
instance to point to my Type instance.

For those wondering about addObjectToBothSidesOfRelationshipWithKey(), the above 2 statements could be replaced with:


type.addObjectToBothSidesOfRelationshipWithKey(newVehicle, "vehicles");

or equivalently:

	newVehicle.addObjectToBothSidesOfRelationshipWithKey(type, "type");

An advantage of invoking addObjectToBothSidesOfRelationshipWithKey() is that it will do the right thing regardless of whether an inverse relationship exists, so it can always be used to set a relationship value, either to-one or to-many. Invoking it instead of direct relationship setter methods also ensures that you won't neglect to set both sides of the relationship.

Aloha,
Art
_______________________________________________
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.



Denis Stanton
email@hidden
Home:  (09) 533 0391
mobile: 021 1433622
_______________________________________________
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: 
 >Re: EO: Should I create primary keys? (From: Art Isbell <email@hidden>)

  • Prev by Date: RE: Correct "Logout" Action
  • Next by Date: Re: [OT] Webserver Statistics Tool
  • Previous by thread: Re: EO: Should I create primary keys?
  • Next by thread: EO: Object Collections?
  • Index(es):
    • Date
    • Thread