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 Fernando <fe...@ptcom.com.br> on 2004/08/30 20:21:37 UTC
Configuring a n:m mapping with multiples PK's
Hello,
I have a n:m relationship, and one of the Parent table have a constraint with 3 PK's. How can I configure my collection-descriptor tag to use this 3 PK's??
Thanks!
Fernando Bernardino
Re: Configuring a n:m mapping with multiples PK's
Posted by FernandoB <fe...@ptcom.com.br>.
Armin , thanks!!
This works fine to me!!
Now I have other problems... Some emails soon.
Thaks for your attencion.
Fernando Bernardino
----- Original Message -----
From: "Armin Waibel" <ar...@apache.org>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Wednesday, September 01, 2004 1:58 PM
Subject: Re: Configuring a n:m mapping with multiples PK's
> Fernando wrote:
>
> > Hello,
> >
> > I have a n:m relationship, and one of the Parent table have a constraint
with 3 PK's. How can I configure my collection-descriptor tag to use this 3
PK's??
> >
>
> Declare all PK fields in the collection-descriptor.
>
> Movie (3 PK) has a m:n relation to Actor (2 PK), thus indirection table
> has 5 columns.
>
> *********************
> In Movie the collection-descriptor looks like
>
> <collection-descriptor
> name="actors"
>
>
collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList
"
> element-class-ref="org.apache.ojb.broker.M2NTest$Actor"
> auto-retrieve="false"
> auto-update="false"
> auto-delete="false"
> indirection-table="M2N_TEST_ROLE"
> >
> <fk-pointing-to-this-class column="MOVIE_ID_INT"/>
> <fk-pointing-to-this-class column="MOVIE_ID2_INT"/>
> <fk-pointing-to-this-class column="MOVIE_ID_STR"/>
> <fk-pointing-to-element-class column="ACTOR_ID"/>
> <fk-pointing-to-element-class column="ACTOR_ID2"/>
> </collection-descriptor>
>
>
> ********************
> In Actor like
>
>
> <collection-descriptor
> name="movies"
>
> collection-class="org.apache.ojb.broker.M2NTest$MovieManageableCollection"
> element-class-ref="org.apache.ojb.broker.M2NTest$MovieImpl"
> auto-retrieve="false"
> auto-update="false"
> auto-delete="false"
> indirection-table="M2N_TEST_ROLE"
> >
> <fk-pointing-to-this-class column="ACTOR_ID"/>
> <fk-pointing-to-this-class column="ACTOR_ID2"/>
> <fk-pointing-to-element-class column="MOVIE_ID_INT"/>
> <fk-pointing-to-element-class column="MOVIE_ID2_INT"/>
> <fk-pointing-to-element-class column="MOVIE_ID_STR"/>
> </collection-descriptor>
>
>
>
> regards,
> Armin
>
> > Thanks!
> >
> > Fernando Bernardino
> >
>
> ---------------------------------------------------------------------
> 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: Configuring a n:m mapping with multiples PK's
Posted by Armin Waibel <ar...@apache.org>.
Fernando wrote:
> Hello,
>
> I have a n:m relationship, and one of the Parent table have a constraint with 3 PK's. How can I configure my collection-descriptor tag to use this 3 PK's??
>
Declare all PK fields in the collection-descriptor.
Movie (3 PK) has a m:n relation to Actor (2 PK), thus indirection table
has 5 columns.
*********************
In Movie the collection-descriptor looks like
<collection-descriptor
name="actors"
collection-class="org.apache.ojb.broker.util.collections.ManageableArrayList"
element-class-ref="org.apache.ojb.broker.M2NTest$Actor"
auto-retrieve="false"
auto-update="false"
auto-delete="false"
indirection-table="M2N_TEST_ROLE"
>
<fk-pointing-to-this-class column="MOVIE_ID_INT"/>
<fk-pointing-to-this-class column="MOVIE_ID2_INT"/>
<fk-pointing-to-this-class column="MOVIE_ID_STR"/>
<fk-pointing-to-element-class column="ACTOR_ID"/>
<fk-pointing-to-element-class column="ACTOR_ID2"/>
</collection-descriptor>
********************
In Actor like
<collection-descriptor
name="movies"
collection-class="org.apache.ojb.broker.M2NTest$MovieManageableCollection"
element-class-ref="org.apache.ojb.broker.M2NTest$MovieImpl"
auto-retrieve="false"
auto-update="false"
auto-delete="false"
indirection-table="M2N_TEST_ROLE"
>
<fk-pointing-to-this-class column="ACTOR_ID"/>
<fk-pointing-to-this-class column="ACTOR_ID2"/>
<fk-pointing-to-element-class column="MOVIE_ID_INT"/>
<fk-pointing-to-element-class column="MOVIE_ID2_INT"/>
<fk-pointing-to-element-class column="MOVIE_ID_STR"/>
</collection-descriptor>
regards,
Armin
> Thanks!
>
> Fernando Bernardino
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org