Entities bound through third entity. Best practice?
Entities bound through third entity. Best practice?
- Subject: Entities bound through third entity. Best practice?
- From: Charilaos Skiadas <email@hidden>
- Date: Fri, 8 Jul 2005 17:48:28 -0500
Sorry for the unclear subject, but I just couldn't find anything
better. I am trying to figure out what the best way to accomplish the
following is:
I have a model with three entities, student, gradeItem, and grade.
Both student and gradeItem have a to-many relationship with grade,
with to-one inverses. The idea I am trying to get to is that
gradeItem stands for a type of grade, say midterm1, midterm2, final
etc. So what I want is for each student, and each gradeItem, for
there to be *exactly one* grade corresponding to them through the
relationships.
The problem I am encountering at this point is, that I would like a
particularly easy way if possible, to make it so that when a new
student is added, a new grade is created for that student and each
gradeItem in existence. Similarly if a new gradeItem is created. Of
course what one has to do is, when a new student is created, simply
go through each gradeItem, and add a grade for it and that student. I
was just hoping that maybe there is a way to do this automagically.
Second problem is, how to ensure that there is exactly one grade
corresponding to each pair of gradeItem-student. I think in my case
this will not be a problem simply because I will not be allowing the
user to create new grades, but instead all grades will be created
upon creation of gradeItems/students. So it's more of an academic
question, whether it is easy to achieve, but nonetheless one that I
would like to know.
Any thoughts?
I must admit I did not look very hard to see if this is answered
anywhere, so please feel more than free to send me to RTFM.
thanks,
Haris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden