You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Mark Lowe <ma...@talk21.com> on 2003/08/12 16:17:36 UTC
foreign keys and addMyObj method
Hello
I just want to double check my thinking on how this works, because
something isn't happening for me..
Okay I've a schema in which i've defined my foreign keys, for example.
<table javaName="Applicant" name="APPLICANT">
//bla bla
<column name="APPLICATION_ID" type="INTEGER" javaName="ApplicationId" />
<foreign-key foreignTable="APPLICATION">
<reference local="APPLICATION_ID" foreign="APPLICATION_ID"/>
</foreign-key>
</table>
<table javaName="Application" name="APPLICATION">
<column name="APPLICATION_ID" primaryKey="true" required="true"
type="INTEGER" autoIncrement="true" javaName="Id" />
The idea being to allow multiple applicants per application..
Now when I want to save my application
Applicant appicant = new Applicant();
//i'm not using beanUtils but for the sake of brevity
BeanUtils.copyProperties(applicant,applicantBean);
ApplicationPeer.addApplicant(applicant);
//save or doInsert() from the peer I've been trying both
applicant.save();
application.save();
These are saved to the DB just applicationId in my applicant table
isn't doing its thing..
Any ideas? Or am i just doing it wrong?
Cheers Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org
Re: foreign keys and addMyObj method
Posted by Mark Lowe <ma...@talk21.com>.
oops.. I wrote that i've been trying
AppicationPeer.addApplicant(app);
but i've been trying the correct
application.addApplicant(app);
just in case any jumps on that quick..
On Tuesday, August 12, 2003, at 03:17 PM, Mark Lowe wrote:
> Hello
>
> I just want to double check my thinking on how this works, because
> something isn't happening for me..
>
>
> Okay I've a schema in which i've defined my foreign keys, for example.
>
> <table javaName="Applicant" name="APPLICANT">
> //bla bla
>
> <column name="APPLICATION_ID" type="INTEGER" javaName="ApplicationId"
> />
>
> <foreign-key foreignTable="APPLICATION">
> <reference local="APPLICATION_ID" foreign="APPLICATION_ID"/>
> </foreign-key>
> </table>
>
>
> <table javaName="Application" name="APPLICATION">
> <column name="APPLICATION_ID" primaryKey="true" required="true"
> type="INTEGER" autoIncrement="true" javaName="Id" />
>
> The idea being to allow multiple applicants per application..
>
> Now when I want to save my application
>
> Applicant appicant = new Applicant();
>
> //i'm not using beanUtils but for the sake of brevity
>
> BeanUtils.copyProperties(applicant,applicantBean);
>
> ApplicationPeer.addApplicant(applicant);
>
> //save or doInsert() from the peer I've been trying both
> applicant.save();
> application.save();
>
>
> These are saved to the DB just applicationId in my applicant table
> isn't doing its thing..
>
> Any ideas? Or am i just doing it wrong?
>
> Cheers Mark
>
>
>
> ---------------------------------------------------------------------
> 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