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 Ollie Rutherfurd <ol...@rutherfurd.net> on 2003/07/10 21:48:28 UTC

mapping M:N relationship, with a twist

Hi,

I'm trying to setup an M:N mapping, however I can't follow the examples in the 
tutorial, as I've got a twist.  Here's what the relationship looks like:

   Category <-> LinkTable <- Item

The hitch is that rows in LinkTable may either refer to rows in the Item
or Category table (depending on a column value).  In otherwords, Category may 
contain 0 or more Categories as well as 0 or more Items.  Both Category and Item 
may be contained by 0 or more Categories.

If anyone had any suggestions or pointers on how to best achieve this type of 
mapping, I'd really appreciate it!

Thanks,
-Ollie

-- 
Ollie Rutherfurd
oliver@rutherfurd.net
http://www.rutherfurd.net/


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: mapping M:N relationship, with a twist

Posted by Matthias Laube <ml...@gmx.de>.
It looks like you should decompose your Category - Item relationship 
into 2 m:n relationships

Category - LinkTable - Category
Category - LinkTable - Item

--
Matthias Laube
mlaube@gmx.de

Ollie Rutherfurd wrote:

> Hi,
>
> I'm trying to setup an M:N mapping, however I can't follow the 
> examples in the tutorial, as I've got a twist.  Here's what the 
> relationship looks like:
>
>   Category <-> LinkTable <- Item
>
> The hitch is that rows in LinkTable may either refer to rows in the Item
> or Category table (depending on a column value).  In otherwords, 
> Category may contain 0 or more Categories as well as 0 or more Items.  
> Both Category and Item may be contained by 0 or more Categories.
>
> If anyone had any suggestions or pointers on how to best achieve this 
> type of mapping, I'd really appreciate it!
>
> Thanks,
> -Ollie
>



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org