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 BOUESSAY Christian <cb...@businessdecision.com> on 2004/09/22 11:24:11 UTC
RE : Collection foreignkey missing
Thanks ...
And how do you manage foreignkeys in this case?
by hand? in a separate SQL script?
What are the alternatives?
(we are planning to use xdoclet generation for more than one hundred classes)
Christian
-------- Message d'origine--------
De: Thomas Paradies [mailto:paradies@transit-online.de]
Date: mer. 22/09/2004 11:06
À: OJB Users List
Cc:
Objet: Re: Collection foreignkey missing
Christian,
if project-schema.xml means torque-schema.xml have look at Tom's reply
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=ojb-user@db.apache.org&msgNo=14428
Thomas
BOUESSAY Christian wrote:
>
> Hello,
>
> There is an association (1:n) between 2 classes:
>
> /**
> * @ojb.class
> * @ojb.field name="idOM" jdbc-type="INTEGER"
> */
> public class Label {
> /**
> * @ojb.field primarykey="true"
> */
> private int id;
>
> // ...
> }
>
> /**
> * @ojb.class
> */
> class OM {
>
> /**
> * @ojb.field primarykey="true"
> */
> private int id;
>
> /**
> * @ojb.collection element-class-ref="Label"
> * foreignkey="idOM"
> */
> private Collection labels;
>
> // ...
> }
>
> In the repository_user.xml :
> <collection-descriptor
> name="labels"
> element-class-ref="Label"
> >
> <inverse-foreignkey field-ref="idOM"/>
> </collection-descriptor>
>
> In the project-schema.xml, there is no <foreign-key> declaration for the table OM ...
>
> What did I miss?
>
> Christian
>
> (I'm a newbie with OJB/xdoclet.
> I didn't found it in the archive, neither in the docs...)
--
+----------------------------------+-----------------------------------+
| tranSIT GmbH | phone: +49 3677 8451 11 |
| Langewiesener Str. 32 | fax: +49 3677 8451 2211 |
| 98693 Ilmenau | mobile: +49 172 3676031 |
| Germany | |
+----------------------------------+-----------------------------------+
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: RE : Collection foreignkey missing
Posted by Thomas Dudziak <to...@first.fhg.de>.
BOUESSAY Christian wrote:
>Thanks ...
>
>And how do you manage foreignkeys in this case?
>by hand? in a separate SQL script?
>
>What are the alternatives?
>
>(we are planning to use xdoclet generation for more than one hundred classes)
>
>
I'm not really sure that you need database-enforced foreignkeys, at
least you shouldn't when you're solely using OJB to access the database.
Also, once you have inheritance mapping to multiple-joined-tables and
m:n relations, you may not even be able to use database-foreignkeys
because there is more than one target table for a given foreignkey.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org