Salut,
http://jakarta.apache.org/turbine/howto/torque-schema-ref.html
I'm not sure if I'm getting your idea right. Are talking about database
relations or about inheritance(?!?!). I think it's the last. Look at the
provided url or at following snippet. Maybe it gives you an idea...
<database name="MY_DATABASE"
defaultIdMethod="idBroker"
package="com.myapp.om"
baseClass="com.myapp.om.BaseClass"
basePeer="com.myapp.om.BasePeer">
<table name="SIMPLE">
<!-- table info goes here -->
</table>
</database>
Looking at this reference I start thinking that it's possible to do all you want with
one schema.xml file. Didn't know it before because I didn't pay enough attention to
the docs (hrmpf!!!).
Aleks
sure if I'm getting your idea right, but I suppose that you are talking
about database relations (?!?!).
* First possibility: If this is the case then you don't have to worry
anymore. With:
<foreign-key foreignTable="CLIENT">
<reference local="CLIENT_ID" foreign="ID"/>
</foreign-key>
you already defined a constraint on the database side. Your java (torque
generated) classes are not "directly" aware of these constraints, but
you'll get an exception if you do a database operation contrary to these
constraints.
* Second possibility: you want to inherit Class1 (your CLIENT table?)
from Class2 (TURBINE_USER?). You can make a
Xavier wrote:
>Hi Aleksandar,
>
>Thanks a lot for answer, I think it the begin of my solution.
>
>But, just a question. Do you have relation something like
>com.mycompany.Bpackage.Class2 -|------o-< com.mycompany.Apackage.Class1
>
>Xa.
>
>-----Message d'origine-----
>De : Vidakovic Aleksandar [mailto:[EMAIL PROTECTED]]
>Envoy� : vendredi 27 juillet 2001 21:45
>� : [EMAIL PROTECTED]
>Objet : Re: Separate om packages
>
>
>Hi Xavier,
>
>I think I had the same problem. Solved it using different schema.xml
>files. Example:
>
>schemas: schema-A.xml, schema-B.xml.
>
>build.xml: you have to add the following:
>
><.....snip......>
>
> <target depends="init-tasks" name="A-om">
> <torque-om contextProperties="${build.A.properties}"
> controlTemplate="${OMControlTemplate}"
>
>outputDirectory="${torque.home}/${outputDirectory}/java"
> outputFile="report.A.om.generation"
> targetPackage="com.mycompany.Apackage"
> templatePath="${templatePath}"
>
>xmlFile="${torque.home}/${schemaDirectory}/schema-A.xml"/>
> </target>
>
> <target depends="init-tasks" name="B-om">
> <torque-om contextProperties="${build.A.properties}"
> controlTemplate="${OMControlTemplate}"
>
>outputDirectory="${torque.home}/${outputDirectory}/java"
> outputFile="report.B.om.generation"
> targetPackage="com.mycompany.Bpackage"
> templatePath="${templatePath}"
>
>xmlFile="${torque.home}/${schemaDirectory}/schema-B.xml"/>
> </target>
>
>
>I didn't put any package information in the schema files. Don't know if
>it's the only way and if that answers your questions, but it worked for
>me just fine.
>
>Aleks
>
>
>Xavier wrote:
>
>>Hi all,
>>
>>I try several thing to generate om classes in different pachage with
>>relation between classes in separate package... :-/ ... I din't get it
>>
>>I read several time
>>http://jakarta.apache.org/turbine/howto/torque-schema-ref.html
>>
>>I'm looking for something like:
>>
>><!-- B A S E S C H E M A-->
>><database>
>>
>> <table name="CLIENT" >
>>
>> <column name="ID" required="true" autoIncrement="true"
>>primaryKey="true" type="INTEGER"/>
>> <column name="NAME" required="true" size="99" type="VARCHAR"/>
>>
>> </table>
>>
>> <table name="TURBINE_USER" package="pf.cs.monapp.om.security">
>>
>> <column name="USER_ID" required="true" primaryKey="true"
>>type="INTEGER"/>
>> <column name="CLIENT_ID" required="true" type="INTEGER"
>>javaName="clientId"/>
>> <column etc.../>
>>
>> <foreign-key foreignTable="CLIENT">
>> <reference local="CLIENT_ID" foreign="ID"/>
>> </foreign-key>
>>
>> </table>
>></database>
>>
>>So, it is possible to generate diff�rente package with one
>>monapp-schema.xml?
>>How that works?
>>May be, it's possible to have something like monapp1-schema.xml and
>>monapp2-schema.xml, include monapp1-schema.xml in the seconde file, to have
>>the possibility to use the foreign-key element to refer a classe generated
>>before from monapp1-schema.xml?
>>
>>
>>Thanks for answers.
>>Xa.
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]