db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Emminger <e...@ericemminger.com>
Subject Re: Foreign keys another great mystery...
Date Tue, 12 Aug 2003 19:11:10 GMT

Let's figure this out. If I understand you correctly, then you're having 
a problem with something that DOES work in Torque. So, let's figure out 
how to make it work for YOU.

Tell me which version of Torque you're using and which database vendor 
and version.

Your schema xml file should have at least the following.

<database name="yourDb">
   <table name="APPLICANT" javaName="Applicant" idMethod="native">
     <column name="id" javaName="Id" type="INTEGER" required="true" 
primaryKey="true" javaType="object"/>
     <column name="APPLICATION_ID" javaName="ApplicationId" 
type="INTEGER" javaType="object"/>
     <foreign-key foreignTable="APPLICATION">
       <reference local="APPLICATION_ID" foreign="APPLICATION_ID"/>

   <table name="APPLICATION" javaName="Application" idMethod="native">
     <column name="APPLICATION_ID" javaName="Id" type="INTEGER" 
required="true" primaryKey="true" javaType="object"/>

Then you should be able to do the following in Java.

Applicant a = new Applicant();
Application app = new Application();

Note that you save (insert) both the Applicant and Application first. 
Then, you relate the Application to the Applicant and save (update) the 
changed Applicant.

If you need more help, please send the relevant part of your schema xml 
file. For each relevant <table> and <column> element, I want to see the 
entire element, NOT "<column ..."


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

View raw message