Re: Modeling Many-to-Many with EOModeler
Re: Modeling Many-to-Many with EOModeler
- Subject: Re: Modeling Many-to-Many with EOModeler
- From: Art Isbell <email@hidden>
- Date: Tue, 10 Aug 2004 22:44:33 -1000
On Aug 10, 2004, at 9:30 PM, Rams wrote:
Consider a Many to Many relationship between a
Student and Teacher entity. Each student has multiple teachers, each
teacher has multiple students. Easy enough, just select 'Join in
Many-to-Many' from the Property menu and you're done. So great, I have
related students for each teacher entity, and teachers for each student
entity, but how do I associate other attributes into that model? Take
grades for example. Each student has exactly one final grade from each
teacher. How do I make that association?
If you want to keep only a single grade for each student-teacher
combination, then you could add a "grade" attribute to the
StudentTeacher entity (the join entity between Student and Teacher).
If you want to maintain a series of grades (e.g., a time series), you
could create a to-many relationship from StudentTeacher to a Grade
entity. In either case, you'll need to expose the join entity by
deleting the flattened Student.teachers and Teacher.students
relationships and making their underlying relationships class
properties (e.g., Student.studentTeachers and Teacher.studentTeachers
or their inverses, depending on which direction you're likely to be
traversing in your app).
To further complicate things, what do I do if I only want Teacher
entities instead? In other words, each teacher entity has been graded
by some number of other teachers?
Do you mean a many-to-many reflexive relationship (i.e., a teacher
grades many teachers and each teacher is graded by many teachers)? If
so, EOModeler doesn't support creating a reflexive many-to-many
relationship. You'll need to do this manually using the
Student-Teacher many-to-many relationship as a guide. Pay very close
attention to every detail including relationship settings.
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.