• 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: Arturo PĂ©rez <email@hidden>
  • Date: Mon, 28 Jul 2003 06:57:36 -0400

On Monday, July 28, 2003, at 05:46  AM, Goodbye Bill wrote:

HEEELP! SQL is pulling me back in! M-m-m-ust... n-n-not... go... back!

QUESTION:
Should I create assign/create my primary keys myself OR should I [is it
possible to] rely entirely upon EO to do it?

You can rely on EO to do it, except for a few funky cases. But even in those
cases there is an EO mechanism to do it.



To create any relationship, one must specify the source and destination
properties (essentially, the primary and foreign keys within the table).
This means that the developer is forced to create the columns for the keys,
assign the key attribute, etc., both while creating the table and while
creating the relationship. This seems to violate the initial goal of EO,
which is to extrapolate the database and the object model.

The above makes it sound as though you are programmatically creating tables
and relationships. If you're using EOModeller then I can't see how to avoid
the above.


The typical scenario is, assuming a completely empty schema.

Make Entity A. That usually means making a table and defining its columns.
The columns are usually Entity A's attributes. I don't think you need to
worry about foreign keys. You do have to designate which attribute is the
primary key by turning on the key icon.


Make Entity B.  Add its attributes.

Add a relationship between the two. You can either do it by control-dragging
from one attribute in A to an attribute in B OR by hitting the add relationship
button and filling in the resultant dialog box. Call this relationship "toAfromB".


Then, in your code, when you want to make the relationship in your code you do
addObjectToBothSidesOfRelationshipWithKey(BObjectInstance, "toAfromB")


and you're done.

-------
WebObjects in Philadelphia.  You want a cheesesteak with that?
_______________________________________________
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: 
 >EO: Should I create primary keys? (From: Goodbye Bill <email@hidden>)

  • Prev by Date: EO: Object Collections?
  • Next by Date: Re: EO: Object Collections?
  • Previous by thread: EO: Should I create primary keys?
  • Next by thread: Re: EO: Should I create primary keys?
  • Index(es):
    • Date
    • Thread