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 <[EMAIL PROTECTED]> To: Apache Torque Users List <[email protected]> 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:[EMAIL PROTECTED] > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
