Re: many-to-many with attributes?
Re: many-to-many with attributes?
- Subject: Re: many-to-many with attributes?
- From: Ian Joyner <email@hidden>
- Date: Wed, 27 Jul 2005 10:30:30 +1000
I use this a lot particularly when I need to put a 'role' into the
relation to express what the m-to-n relationship is about. What I
found was that it is best to just do this by hand and not use
EOModeler's Property:Join in Many-to-Many.
1) In particular, I found that the flattened relationships between
the two tables, across the join table gave problems at run time, like
key was not visible, or something like that.
2) Second problem is that EOModeler's join table used the two foreign
keys as its compound primary key, so the important thing was to give
this table its own primary key separate from the foreign keys. Mind
you, you probably want the foreign key combination to be unique,
unless a single user can have many different roles in the same group.
Perhaps the problems, I had with (1) are solved by (2), since I came
up with (2) later, but it is not hard to have to code the path
group.users.user.name instead of group.user.name, especially when you
want to get group.users.role.
This might or might not be non-optimal (if others have a better
solution), but it does what you want, and it works.
Ian
Sportstec
On 27/07/2005, at 3:34 AM, Jim Zajkowski wrote:
Hi there,
What's the best way to handle a many-to-many relationship that has
an attribute on the relation?
That is, let's say I have a table of users, and a table of groups.
I want a m-to-m relation between them, since clearly more than one
user can belong to a group, and I'd like to see what users are in a
group.
But I also want to include some form of "access level" (e.g.,
moderator, administrator, regular user).
In DB land I'd model this by having an additional attribute on the
users-groups table. But when I've done that in EOModeler, it
creates a flattened relation, and so there isn't a way to see that
attribute.
So, what's the best way to do it? Not flatten the relation and
walk the m-to-m by hand?
Thanks,
--Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40sportstec.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden