db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shilpa Kulkarni <shilpakulka...@yahoo.com>
Subject Re: AW: Setting foreign key column as null
Date Tue, 09 Jan 2007 21:10:23 GMT
Thanks for your reply.

Wouldn't this change other the generated classes as well. There is lot of code already passing
primitives to exisiting data classes.  Is there anything that can be  specifically done for
this  column? 

Shilpa


----- Original Message ----
From: Thoralf Rickert <thoralf.rickert@cadooz.de>
To: Apache Torque Users List <torque-user@db.apache.org>
Sent: Tuesday, January 9, 2007 1:45:37 AM
Subject: AW: Setting foreign key column as null

Hi!

Did you try <database defaultJavaType="object">. Then every primitive (long,int,boolean,...)
is an object (Long, Integer, Boolean, ...). I think, you cannot set this for a single table.
Just for all. 

bye
Thoralf


> -----Urspr√ľngliche Nachricht-----
> Von: Shilpa Kulkarni [mailto:shilpakulkarni@yahoo.com] 
> Gesendet: Dienstag, 9. Januar 2007 01:21
> An: Apache Torque Users List
> Betreff: Setting foreign key column as null
> 
> 
> I am having trouble setting a foreign key value to null. 
> Parts of my torque schema file are below. 
> table_2.parent_asset_id has a foreign key constraint defined 
> on it & it must be either null or one of the table_1.asset_id 
> column values.
> 
>   <table name="table_1"
>      idMethod="native">
>     <column
>       name="asset_id"
>       required="true"
>       primaryKey="true"
>       type="BIGINT"
>       description="ASSET ID"/>
>   </table>
> 
> 
>   <table name="table_2"
>      idMethod="none">
>     <column
>       name="parent_asset_id"
>       required="false"
>       primaryKey="false"
>       type="BIGINT" />
> 
> <!-- Some other columns defined here. -->
> 
>     <foreign-key foreignTable="table_1">
>       <reference
>         local="parent_asset_id"
>         foreign="asset_id"/>
>     </foreign-key>
>   </table>
> 
> I want to be able to write code as follows:
> 
> Table2Bean table2Bean = new Table2Bean();
> table2Bean.setParentAssetId(null);
> 
> However the setParentAssetId method in generated bean class 
> takes has input parameter of type 'long'. So passing null 
> does not work. 
> 
> The generated method in Table2Bean class looks like this:  
> public void setParentAssetId(long v)
>     {
>   
>         this.parentAssetId = v;
>         setModified(true);
> 
>     }
> 
> 
> If the generated method was taking an object paramter (Long 
> instead of long), it would work. 
> 
> Any idea how to make it work? Any help is appreciated.
> 
> Shilpa
> 
> 
> 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around 
> http://mail.yahoo.com
> 
> ---------------------------------------------------------------------
> 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





__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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