• 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: Object Collections?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EO: Object Collections?


  • Subject: Re: EO: Object Collections?
  • From: Jonathan Rochkind <email@hidden>
  • Date: Mon, 28 Jul 2003 12:01:44 -0500

At 05:52 AM 7/28/2003 -0400, Goodbye Bill wrote:
SCENARIO:
Assume we have two objects in our model: "Song" and "Genre."  The goal is to
be able to assign each "Song" object to multiple "Genre" objects.

QUESTION:
Using the example above, must there be some type of third object -- possibly
a "SongGenreAssignment" object to allow for a many-to-many relationship?

Yes. The nature of an SQL-based relational database is that a many-to-many relationship requires an intermediary 'join' or 'assignment' table.


With EOModeler, if you select two entities, and choose the 'create many-to-many relationship' menu option, EOModeler will automatically create an entity for this 'join' table, as well as all the relationships involved. EOModeler will create these relationships as 'flattened', which means that your Java code can in fact ignore the existence of this intermediary 'join' table---EOF conveniently hides it for you, and you can just deal with the many-to-many relationship between the two entities, and not think about how it's implemented (with the join table).

Beware, I think when EOModeler creates the entity for this 'join' table, it leaves out column names. You need to examine this join entity in EOModeler, make sure it's all filled out right---and then make sure the table is actually created in the db, one way or another! (EOModeler's schema synchronization, or by hand, whatever). But once you have everything set up in EOModeler, the point of the 'flattened' relationships are to let you forget the join table exists.

I'm sure there's a chapter in the EOF Developer's Guide about this. That document is really worth a read.

It would appear that EO should take care of this thing automatically if the
developer is to be able to break away from manipulating the database
directly.

Well, it sort of does. See above.

Unfortunately, there does not appear to be any way to define a
collection of objects within EO, other than using a relationship (which does
not allow for a many-to-many hierarchy).

True that there's no way to define a collection of objects within EOF, other than a relationship. (No way I can think of, depending on what you mean by a 'collection of objects'). False that there's no such thing as a many-to-many relationship.


--Jonathan



_______________________________________________
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: 
 >EO: Object Collections? (From: Goodbye Bill <email@hidden>)

  • Prev by Date: Re: EO: Should I create primary keys?
  • Next by Date: Saving entities problem [SOLVED]
  • Previous by thread: EO: Object Collections?
  • Next by thread: Re: EO: Object Collections?
  • Index(es):
    • Date
    • Thread