• 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: Art Isbell <email@hidden>
  • Date: Mon, 28 Jul 2003 21:34:25 -1000

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.

  • Follow-Ups:
    • Re: EO: Should I create primary keys?
      • From: Denis Stanton <email@hidden>
References: 
 >Re: EO: Should I create primary keys? (From: Denis Stanton <email@hidden>)

  • Prev by Date: Re: Postgresql Failing to Provide a Primary
  • Next by Date: Correct "Logout" Action
  • Previous by thread: Re: EO: Should I create primary keys?
  • Next by thread: Re: EO: Should I create primary keys?
  • Index(es):
    • Date
    • Thread