• 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: Creating Relationships - BOGUS?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EO: Creating Relationships - BOGUS?


  • Subject: Re: EO: Creating Relationships - BOGUS?
  • From: Art Isbell <email@hidden>
  • Date: Fri, 1 Aug 2003 16:55:16 -1000

On Friday, August 1, 2003, at 04:13  PM, Goodbye Bill wrote:

How the heck is one supposed to create ONE-to-many relationships?

There's an "New Relationship in Selected Entity" button in the toolbar along the top of the EOModeler window or a Property > Add Relationship menu.


Now, I WOULD LIKE to be able to create my objects as BASIC as possible (with
only my properties)... WITHOUT me having to specify ANY keys. THEN, click a
button or three and have EO take care of the rest, behind the scenes.

Now you're getting the picture :-)

Example:

    ENTITY #1 : "Album"
    PROPERTIES: "Name" (notice there is only one)

    ENTITY #2 : "Song"
    PROPERTIES: "Name" (notice there is only one... again)

Using the example above, I want to be able to add a one-to-one relationship
to the "Album" entity (probably called "Songs") and have EO create all of
the primary and foreign key relationships.

To your model, you'll have to add Album.oid and Song.oid primary keys and a Song.oidAlbum foreign key, none of which are class properties and so won't be referenced in your code. But they will be a real DB columns. You'll join Song.oidAlbum to Album.oid in the Relationship Inspector when you create the Song.album relationship. You'll do the same creating the inverse relationship, Album.songs. This can be done in a single step using in the Diagram view by control-dragging a relationship from Song.oidAlbum to Album.oid, for example.


At this point I usually try to decide whether I'm really going to traverse the object graph in both directions (i.e., using both Song.album and Album.songs). I try not to, so I make only one of these relationships a class property to avoid fetching that's not necessary if I'm not traversing the object graph in both directions.

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.

References: 
 >EO: Creating Relationships - BOGUS? (From: Goodbye Bill <email@hidden>)

  • Prev by Date: Re: EO: Creating Relationships - BOGUS?
  • Next by Date: Re: Xcode
  • Previous by thread: Re: EO: Creating Relationships - BOGUS?
  • Next by thread: EO: Not propagating key values...
  • Index(es):
    • Date
    • Thread