db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Greg Monroe" <Greg.Mon...@DukeCE.com>
Subject RE: AW: Setting foreign key column as null
Date Thu, 11 Jan 2007 18:15:50 GMT
Played around with your sample schema and think I found 
the issue here.  With forgeign key columns, both the 
local and related columns need to be define using the same
javaType setting.

The issue is that in complex object mode, Torque objects
allow for forgeign keys to be set by using the foreign key
object.  E.g.:

Table1 t1 = <some existing object>
Table2 t2 = new Table2();
t2.setValue1(xxx);
t2.setTable1(t1);

The advantage to this is that you don't have to know anything
about the keys used to relate t1 and t2, just that they are
related.

However, if the object types are different between the related
tables, the logic to generate code to do the right transformation
between types gets to be too complicated.

> -----Original Message-----
> From: Shilpa Kulkarni [mailto:shilpakulkarni@yahoo.com] 
> Sent: Wednesday, January 10, 2007 5:34 PM
> To: Apache Torque Users List
> Subject: Re: AW: Setting foreign key column as null
> 
> Hi. Thanks for your help.
> 
> Defining javaType as object for a column name seemed like the 
> best solution. However the generated classes do not compile. 
> 
> The setParentAssetId method now takes a 'Long'  instead of 
> 'long' which will help me set it to null. However some 
> methods in the generated bean & data class still pass a long 
> to setParentAssetId method ( eg. setParentAssetId(0); ) & it 
> does not compile. I am using torque-3.2. 
> 
> Any suggestions? 
> 
> Shilpa

Duke CE Privacy Statement
Please be advised that this e-mail and any files transmitted with it are confidential communication
or may otherwise be privileged or confidential and are intended solely for the individual
or entity to whom they are addressed.  If you are not the intended recipient you may not rely
on the contents of this email or any attachments, and we ask that you  please not read, copy
or retransmit this communication, but reply to the sender and destroy the email, its contents,
and all copies thereof immediately.  Any unauthorized dissemination, distribution or copying
of this communication is strictly prohibited.



---------------------------------------------------------------------
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