db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lowe <mark.l...@talk21.com>
Subject Re: Foreign keys another great mystery...
Date Tue, 12 Aug 2003 22:01:23 GMT
Eric

Fixed with defining the methodId="native" ..

I thought i read that the native method id was the default so i didn't 
use it, but after i didn't get anywhere with my other attempts and the 
unambiguous "DOES work". I tooth combed your example, and thought what 
the hell.

Torque is good again and my friend.

Should I persevere with inheritance then? or not?

Cheers Mark


On Tuesday, August 12, 2003, at 08:50 PM, Mark Lowe wrote:

> Thanks for the response Eric
>
> You've done exactly what I've been trying.. Although the javaType 
> attribute is something I'll have to be less sloppy about.
>
> The java you wrote is precisely what i was trying but I think I was 
> getting a bit blinded by the elegance of the OO methods and I need to 
> use look into the options using Peers. But if you've had this approach 
> working then, I'd like to know.
>
> The java is exactly what i've been trying to the letter and as i 
> mentioned my schema is only missing the javaType attribute. Everything 
> else to the letter.
>
> No exceptions, not a whisper.
>
> Cheers Mark
>
> On Tuesday, August 12, 2003, at 08:11 PM, Eric Emminger wrote:
>
>> Mark
>>
>> 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"/>
>>     </foreign-key>
>>   </table>
>>
>>   <table name="APPLICATION" javaName="Application" idMethod="native">
>>     <column name="APPLICATION_ID" javaName="Id" type="INTEGER" 
>> required="true" primaryKey="true" javaType="object"/>
>>   </table>
>> </database>
>>
>>
>> Then you should be able to do the following in Java.
>>
>> Applicant a = new Applicant();
>> Application app = new Application();
>> a.save();
>> app.save();
>> a.setApplication(app);
>> a.save();
>>
>> 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 ..."
>>
>> Eric
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: torque-user-help@db.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


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


Mime
View raw message