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 Reda Benzair <re...@smartjog.com> on 2003/12/03 13:22:54 UTC

mapping M:N relation WITH ATTRIBUTES

Hi all,
 
I would like to map an M:N relation WITH ATTRIBUTES but seem to be
unable to do it with OJB... 
By "WITH ATTRIBUTES" I mean that there is typically some more fields in
the indirection table than just foreign keys. 
Do I have to use 1:N N:1 mapping instead?
 
A dummy example:
 
Table Employee       Table Employee_Company (M:N)            Table
Company
--------------       ---------------------------
------------------
 EMP_ID                 CPY_ID                                 CPY_ID
 NAME                   EMP_ID                                  NAME  
                        Comment

 

How can I map the "Comment" field if I use a M:N mapping? If it's not
possible today, will it ever be? when?

 

I'm currently using RC4 with Oracle 8i.

 

I thank you in advance, 




---------------------------------------------------------------------
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 relation WITH ATTRIBUTES

Posted by Thomas Dudziak <to...@first.gmd.de>.
Where would the Comment field be stored in the Java objects ? If you have
a separate Java class for the connection between Employees and Companies
which contains the Comment field, then you already have manual
decomposition (see 
http://db.apache.org/ojb/tutorial3.html#Manual%20decomposition%20into%20two%201:n%20associations).

Tom



---------------------------------------------------------------------
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 relation WITH ATTRIBUTES

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
M:N mapping can be done using a indirection table to store relational information.
In that case OJB uses a class called MtoNImplementor that holds the fk values that must be inserted onto the
indirection table. There is a problem if you want to store more data other than the fk values, thats wy I´m planning to make MtoNImplementos configurable in your repository.xml file so that ojb uses your implementation
to map M:N . Please see PersistenceBrokerImpl MtoN related methods.

On Mon, 8 Dec 2003 10:59:08 +0100, "Reda Benzair" <re...@smartjog.com> escreveu:

> De: "Reda Benzair" <re...@smartjog.com>
> Data: Mon, 8 Dec 2003 10:59:08 +0100
> Para: "'OJB Users List'" <oj...@db.apache.org>
> Assunto: mapping M:N relation WITH ATTRIBUTES 
> 
> 
> Hi Rodrigo
> Thank you very much for your response
> I have another question?
> I can have more information on your implementation for this problem of
> MtoNImplementors ?
> What is your solution 
> And can Help you  for implemente this solution 
> Because this problem is very important for my application and my only
> the solution for me at this time is convert the M:N  to 1:N but is bad
> solution !!!!!
> 
> 
> 
> -----Original Message-----
> From: Leandro Rodrigo Saad Cruz [mailto:leandro@ibnetwork.com.br] 
> Sent: mercredi 3 décembre 2003 14:40
> To: OJB Users List
> Subject: Re: mapping M:N relation WITH ATTRIBUTES 
> 
> Hi Reda. I´m working on this problem through the implementation of
> specific MtoNImplementors.
> I dunno when I´ll be able to finish this.. but this is supposed to solve
> problems like yours.
> 
> On Wed, 3 Dec 2003 13:22:54 +0100, "Reda Benzair"
> <re...@smartjog.com> escreveu:
> 
> > De: "Reda Benzair" <re...@smartjog.com>
> > Data: Wed, 3 Dec 2003 13:22:54 +0100
> > Para: "'OJB Users List'" <oj...@db.apache.org>
> > Assunto: mapping M:N relation WITH ATTRIBUTES 
> > 
> > Hi all,
> >  
> > I would like to map an M:N relation WITH ATTRIBUTES but seem to be
> > unable to do it with OJB... 
> > By "WITH ATTRIBUTES" I mean that there is typically some more fields
> in
> > the indirection table than just foreign keys. 
> > Do I have to use 1:N N:1 mapping instead?
> >  
> > A dummy example:
> >  
> > Table Employee       Table Employee_Company (M:N)            Table
> > Company
> > --------------       ---------------------------
> > ------------------
> >  EMP_ID                 CPY_ID                                 CPY_ID
> >  NAME                   EMP_ID                                  NAME  
> >                         Comment
> > 
> >  
> > 
> > How can I map the "Comment" field if I use a M:N mapping? If it's not
> > possible today, will it ever be? when?
> > 
> >  
> > 
> > I'm currently using RC4 with Oracle 8i.
> > 
> >  
> > 
> > I thank you in advance, 
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> > For additional commands, e-mail: ojb-user-help@db.apache.org
> > 
> > 
> > 
> > 
> 
> --
> Leandro Rodrigo Saad Cruz
> IT - Inter Business Tecnologia e
> Serviços (IB)
> http://www.ibnetwork.com.br
> http://db.apache.org/ojb
> http://xingu.sf.net
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 
> 
> 

--
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e
Serviços (IB)
http://www.ibnetwork.com.br
http://db.apache.org/ojb
http://xingu.sf.net


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


mapping M:N relation WITH ATTRIBUTES

Posted by Reda Benzair <re...@smartjog.com>.
Hi Rodrigo
Thank you very much for your response
I have another question?
I can have more information on your implementation for this problem of
MtoNImplementors ?
What is your solution 
And can Help you  for implemente this solution 
Because this problem is very important for my application and my only
the solution for me at this time is convert the M:N  to 1:N but is bad
solution !!!!!



-----Original Message-----
From: Leandro Rodrigo Saad Cruz [mailto:leandro@ibnetwork.com.br] 
Sent: mercredi 3 décembre 2003 14:40
To: OJB Users List
Subject: Re: mapping M:N relation WITH ATTRIBUTES 

Hi Reda. I´m working on this problem through the implementation of
specific MtoNImplementors.
I dunno when I´ll be able to finish this.. but this is supposed to solve
problems like yours.

On Wed, 3 Dec 2003 13:22:54 +0100, "Reda Benzair"
<re...@smartjog.com> escreveu:

> De: "Reda Benzair" <re...@smartjog.com>
> Data: Wed, 3 Dec 2003 13:22:54 +0100
> Para: "'OJB Users List'" <oj...@db.apache.org>
> Assunto: mapping M:N relation WITH ATTRIBUTES 
> 
> Hi all,
>  
> I would like to map an M:N relation WITH ATTRIBUTES but seem to be
> unable to do it with OJB... 
> By "WITH ATTRIBUTES" I mean that there is typically some more fields
in
> the indirection table than just foreign keys. 
> Do I have to use 1:N N:1 mapping instead?
>  
> A dummy example:
>  
> Table Employee       Table Employee_Company (M:N)            Table
> Company
> --------------       ---------------------------
> ------------------
>  EMP_ID                 CPY_ID                                 CPY_ID
>  NAME                   EMP_ID                                  NAME  
>                         Comment
> 
>  
> 
> How can I map the "Comment" field if I use a M:N mapping? If it's not
> possible today, will it ever be? when?
> 
>  
> 
> I'm currently using RC4 with Oracle 8i.
> 
>  
> 
> I thank you in advance, 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 
> 

--
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e
Serviços (IB)
http://www.ibnetwork.com.br
http://db.apache.org/ojb
http://xingu.sf.net


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



---------------------------------------------------------------------
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 relation WITH ATTRIBUTES

Posted by Leandro Rodrigo Saad Cruz <le...@ibnetwork.com.br>.
Hi Reda. I´m working on this problem through the implementation of specific MtoNImplementors.
I dunno when I´ll be able to finish this.. but this is supposed to solve problems like yours.

On Wed, 3 Dec 2003 13:22:54 +0100, "Reda Benzair" <re...@smartjog.com> escreveu:

> De: "Reda Benzair" <re...@smartjog.com>
> Data: Wed, 3 Dec 2003 13:22:54 +0100
> Para: "'OJB Users List'" <oj...@db.apache.org>
> Assunto: mapping M:N relation WITH ATTRIBUTES 
> 
> Hi all,
>  
> I would like to map an M:N relation WITH ATTRIBUTES but seem to be
> unable to do it with OJB... 
> By "WITH ATTRIBUTES" I mean that there is typically some more fields in
> the indirection table than just foreign keys. 
> Do I have to use 1:N N:1 mapping instead?
>  
> A dummy example:
>  
> Table Employee       Table Employee_Company (M:N)            Table
> Company
> --------------       ---------------------------
> ------------------
>  EMP_ID                 CPY_ID                                 CPY_ID
>  NAME                   EMP_ID                                  NAME  
>                         Comment
> 
>  
> 
> How can I map the "Comment" field if I use a M:N mapping? If it's not
> possible today, will it ever be? when?
> 
>  
> 
> I'm currently using RC4 with Oracle 8i.
> 
>  
> 
> I thank you in advance, 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 
> 

--
Leandro Rodrigo Saad Cruz
IT - Inter Business Tecnologia e
Serviços (IB)
http://www.ibnetwork.com.br
http://db.apache.org/ojb
http://xingu.sf.net


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