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 Tulsi Das <qu...@yahoo.com> on 2003/10/14 21:03:57 UTC

two foreign keys

Hello, I need a table with two foreign keys to the same table, i.e:

<table name="usuario">
 <column name="usuario_id" primaryKey="true" required="true"
type="INTEGER"/>
 ...
</table>

now I have another table that has TWO foreign keys to this "usuario"
table, like this:

<table name="agenciamiento">
 <column name="agenciamiento_id" primaryKey="true" required="true"
type="INTEGER"/>
 <column name="usuario_origen" required="true" type="INTEGER"/>
 <column name="usuario_destino" required="true" type="INTEGER"/>
 ...
<foreign-key foreignTable="usuario">
 <reference foreign="usuario_id" local="usuario_origen"/>
</foreign-key>
<foreign-key foreignTable="usuario">
 <reference foreign="usuario_id" local="usuario_origen"/>
</foreign-key>        
</table>    


It generates the classes ok, but the Agenciamiento class should have:

Usuario getUsuarioDestino()
Usuario getUsuarioOrigen()

as expected

instead, I got:

int getUsuarioDestino()
int getUsuarioOrigen()

any ideas why it doesn´t work?

thank you very much

Tulsi


------------
Internet GRATIS es Yahoo! Conexión
4004-1010 desde Buenos Aires. Usuario: yahoo; contraseña: yahoo
Más ciudades: http://conexion.yahoo.com.ar

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


Re: two foreign keys

Posted by Tulsi Das <qu...@yahoo.com>.
Indeed it did

thanks a lot!

Tulsi

 --- Marissa Smith <ma...@shadebirdair.com> escribió: 
> Tulsi,
> 
> Check to see if Torque is generating the following methods in the 
> Agenciamiento class:
> 
> Usuario getUsuarioRelatedByUsuarioOrigen()
> 
> and
> 
> Usuario getUsuarioRelatedByUsuarioDestino()
> 
> 
> I have similar table relationships in some of my tables and torque
> produces 
> these "RelatedBy" methods for them.
> I am using Torque 3.1-alpha
> 
> Hope this helps!
> 
> Regards,
> 
> Marissa Smith.
> 
> 
> 
> At 04:03 PM 10/14/2003 -0300, you wrote:
> >Hello, I need a table with two foreign keys to the same table, i.e:
> >
> ><table name="usuario">
> >  <column name="usuario_id" primaryKey="true" required="true"
> >type="INTEGER"/>
> >  ...
> ></table>
> >
> >now I have another table that has TWO foreign keys to this "usuario"
> >table, like this:
> >
> ><table name="agenciamiento">
> >  <column name="agenciamiento_id" primaryKey="true" required="true"
> >type="INTEGER"/>
> >  <column name="usuario_origen" required="true" type="INTEGER"/>
> >  <column name="usuario_destino" required="true" type="INTEGER"/>
> >  ...
> ><foreign-key foreignTable="usuario">
> >  <reference foreign="usuario_id" local="usuario_origen"/>
> ></foreign-key>
> ><foreign-key foreignTable="usuario">
> >  <reference foreign="usuario_id" local="usuario_origen"/>
> ></foreign-key>
> ></table>
> >
> >
> >It generates the classes ok, but the Agenciamiento class should
> have:
> >
> >Usuario getUsuarioDestino()
> >Usuario getUsuarioOrigen()
> >
> >as expected
> >
> >instead, I got:
> >
> >int getUsuarioDestino()
> >int getUsuarioOrigen()
> >
> >any ideas why it doesn´t work?
> >
> >thank you very much
> >
> >Tulsi
> >
> >
> >------------
> >Internet GRATIS es Yahoo! Conexión
> >4004-1010 desde Buenos Aires. Usuario: yahoo; contraseña: yahoo
> >Más ciudades: http://conexion.yahoo.com.ar
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> >For additional commands, e-mail: torque-user-help@db.apache.org
>  

------------
Internet GRATIS es Yahoo! Conexión
4004-1010 desde Buenos Aires. Usuario: yahoo; contraseña: yahoo
Más ciudades: http://conexion.yahoo.com.ar

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


Re: two foreign keys

Posted by Marissa Smith <ma...@shadebirdair.com>.
Tulsi,

Check to see if Torque is generating the following methods in the 
Agenciamiento class:

Usuario getUsuarioRelatedByUsuarioOrigen()

and

Usuario getUsuarioRelatedByUsuarioDestino()


I have similar table relationships in some of my tables and torque produces 
these "RelatedBy" methods for them.
I am using Torque 3.1-alpha

Hope this helps!

Regards,

Marissa Smith.



At 04:03 PM 10/14/2003 -0300, you wrote:
>Hello, I need a table with two foreign keys to the same table, i.e:
>
><table name="usuario">
>  <column name="usuario_id" primaryKey="true" required="true"
>type="INTEGER"/>
>  ...
></table>
>
>now I have another table that has TWO foreign keys to this "usuario"
>table, like this:
>
><table name="agenciamiento">
>  <column name="agenciamiento_id" primaryKey="true" required="true"
>type="INTEGER"/>
>  <column name="usuario_origen" required="true" type="INTEGER"/>
>  <column name="usuario_destino" required="true" type="INTEGER"/>
>  ...
><foreign-key foreignTable="usuario">
>  <reference foreign="usuario_id" local="usuario_origen"/>
></foreign-key>
><foreign-key foreignTable="usuario">
>  <reference foreign="usuario_id" local="usuario_origen"/>
></foreign-key>
></table>
>
>
>It generates the classes ok, but the Agenciamiento class should have:
>
>Usuario getUsuarioDestino()
>Usuario getUsuarioOrigen()
>
>as expected
>
>instead, I got:
>
>int getUsuarioDestino()
>int getUsuarioOrigen()
>
>any ideas why it doesn´t work?
>
>thank you very much
>
>Tulsi
>
>
>------------
>Internet GRATIS es Yahoo! Conexión
>4004-1010 desde Buenos Aires. Usuario: yahoo; contraseña: yahoo
>Más ciudades: http://conexion.yahoo.com.ar
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org