db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shilpa Kulkarni <shilpakulka...@yahoo.com>
Subject Setting foreign key column as null
Date Tue, 09 Jan 2007 00:20:59 GMT
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


Mime
View raw message