OK, the problem is solved by specifing javaType="object" to both tables
columns

-D

----- Original Message -----
From: "Dan Tran" <[EMAIL PROTECTED]>
To: "Turbine Torque Users List" <[EMAIL PROTECTED]>
Sent: Saturday, December 14, 2002 9:56 PM
Subject: Re: null foreign key not allow


> Well I followed the advice and added javaType="object" attribute to the
> reference column.  This time torque generate syntax error:
>
> <snippet>
>
>         public void setGiaolyId(Integer v) throws TorqueException
>         {
>            if (!ObjectUtils.equals(this.giaoly_id, v))
>           {
>               this.giaoly_id = v;
>               setModified(true);
>           }
>
>           if (aGiaoly != null && !(aGiaoly.getGiaolyId()==v))   //<----
this
> is the error with == operator
>           {
>               aGiaoly = null;
>           }
>
>       }
>
>
>     public void setGiaoly(Giaoly v) throws TorqueException
>     {
>            if (v == null)
>         {
>                         setGiaolyId(0);   <---- only accept Integer object
>                     }
>         else
>         {
>             setGiaolyId(v.getGiaolyId());     <----- same as above
>         }
>            aGiaoly = v;
>     }
>
> </snipet>
>
> and other error
>
> What have I done wrong here?
>
> -D
> ----- Original Message -----
> From: "Martin Poeschl" <[EMAIL PROTECTED]>
> To: "Turbine Torque Users List" <[EMAIL PROTECTED]>
> Sent: Saturday, December 14, 2002 6:12 AM
> Subject: Re: null foreign key not allow
>
>
> > Dan Tran wrote:
> >
> > >Hi,
> > >
> > >I have table A which has  INTEGER column references (foreign key) a row
> ID of another table B.
> > >The reference is null allow.
> > >
> > >When I create A object with null value of the B object reference, a
save
> to DB of object A throws
> > >excexption, expecting Table B to have a row with ID 0.
> > >
> > >My configuration is MSSQL, Torque 3.0, MS driver.
> > >
> > >Is this a bug?
> > >
> > if you take a look at the java code you'll see the id is stored as int
> > .. so it can't be null
> > if you need the column to be nullable set javaType="object" .. so it
> > will be an Integer in the java code which can be null
> >
> > martin
> >
> > >
> > >Please advice.
> > >
> > >-Dan
> > >
> > >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to