You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Yuji Shinozaki <ys...@virginia.edu> on 2003/03/02 04:25:24 UTC
m:n decomposed and non-decomposed relations
Can you deal with a relation as a non-decomposed m:n in one object and as
a decomposed m:n another? Will you run into problems doing this?
For example, suppose you have a USER table and a ROLE table that are
related by a USER_ROLE table: a simple m:n relationship which I would like
to deal with as a non-decomposed m:n in the USER and ROLE objects, so that
you can simply do user.getRoleCollection() or a role.getUserCollection().
Also suppose there is also an ITEM and LIST table in an m:n relationship
via a ITEM_LIST table. I would like to treated as non-decomposed one, so
that you could have item.getListCollection(), list.getItemCollection()
methods.
There is also an INCLUSION table that relates the USER_ROLE and ITEM_LIST
tables in an m:n relationship (To tell you who in what role, included what
item in which list. And yes, multiple user/roles can include the same
item in a list -- sort of a "list of people who requested this item on
this list").
In the object model, I would like treat that Inclusion relationship as
decomposed. So that I could have a method list.getInclusionCollection()
which would give me all the Inclusions to this list.
USER_ROLE is both involved in an m:n decomposed and m:n non-decomposed
relationship. Will this cause problems?
USER: USER_ROLE: ROLE:
USER_ID(PK) USER_ID(FK:USER) ROLE_ID(PK)
ROLE_ID(FK:ROLE)
ITEM: ITEM_LIST: LIST:
ITEM_ID(PK) ITEM_ID(FK: ITEM) LIST_ID(PK)
LIST_ID(FK: LIST)
INCLUSION:
USER_ID,ROLE_ID(FK: USER_ROLE)
ITEM_ID,LIST_ID(FK: ITEM_LIST)
Thanks in advanced,
yuji
----
Yuji Shinozaki Computer Systems Senior Engineer
ys2n@virginia.edu Advanced Technologies Group
(804)924-7171 Information Technology & Communication
http://www.people.virginia.edu/~ys2n University of Virginia
Re: m:n decomposed and non-decomposed relations
Posted by Thomas Mahler <th...@web.de>.
I see no problem here.
Thomas
Yuji Shinozaki wrote:
> Can you deal with a relation as a non-decomposed m:n in one object and as
> a decomposed m:n another? Will you run into problems doing this?
>
> For example, suppose you have a USER table and a ROLE table that are
> related by a USER_ROLE table: a simple m:n relationship which I would like
> to deal with as a non-decomposed m:n in the USER and ROLE objects, so that
> you can simply do user.getRoleCollection() or a role.getUserCollection().
>
> Also suppose there is also an ITEM and LIST table in an m:n relationship
> via a ITEM_LIST table. I would like to treated as non-decomposed one, so
> that you could have item.getListCollection(), list.getItemCollection()
> methods.
>
> There is also an INCLUSION table that relates the USER_ROLE and ITEM_LIST
> tables in an m:n relationship (To tell you who in what role, included what
> item in which list. And yes, multiple user/roles can include the same
> item in a list -- sort of a "list of people who requested this item on
> this list").
>
> In the object model, I would like treat that Inclusion relationship as
> decomposed. So that I could have a method list.getInclusionCollection()
> which would give me all the Inclusions to this list.
>
> USER_ROLE is both involved in an m:n decomposed and m:n non-decomposed
> relationship. Will this cause problems?
>
>
> USER: USER_ROLE: ROLE:
> USER_ID(PK) USER_ID(FK:USER) ROLE_ID(PK)
> ROLE_ID(FK:ROLE)
>
> ITEM: ITEM_LIST: LIST:
> ITEM_ID(PK) ITEM_ID(FK: ITEM) LIST_ID(PK)
> LIST_ID(FK: LIST)
>
> INCLUSION:
> USER_ID,ROLE_ID(FK: USER_ROLE)
> ITEM_ID,LIST_ID(FK: ITEM_LIST)
>
> Thanks in advanced,
>
> yuji
> ----
> Yuji Shinozaki Computer Systems Senior Engineer
> ys2n@virginia.edu Advanced Technologies Group
> (804)924-7171 Information Technology & Communication
> http://www.people.virginia.edu/~ys2n University of Virginia
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>