You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Pugh, Eric" <EP...@MuseumCompany.com> on 2002/01/02 20:14:04 UTC

Maybe a bug in Torque...

Hi all,

I think I have found a bug in torque that comes with tdk2.1.  I am not sure
if this has been fixed in 2.2.  When an object has a null forign key, the
check looks at the objects NumberKey.  According to the source in
jakarta-turbine-2 for NumberKey , if the key is null, then it should return
false.  However this causes the base objects to be constantly executing:
select * from sometable where sometable_id=null.

This is not what I want, and I don't think this should be the default
behavior.

I looked in jakarta-turbine-torque as well, and the same problem exists.

I am able to fix the problem by tweaking my Object.vm file to be:
#set ( $conditional = $strings.concat([$conditional, $and,
"!ObjectUtils.equals(this.", $clo, ".getValue(), null)"]) )

instead of

#set ( $conditional = $strings.concat([$conditional, $and,
"!ObjectUtils.equals(this.", $clo, ", null)"]) )


I am not sure if this a bug or a limitation, but I am looking for
confirmation that the behavoir that I am seeing is still present in the
newer versions, or should I be upgrading to tdk 2.2?  It does seem to me
that the best behavior would be to throw an exception like
NullReferenceKeyException, otherwise any code that you use has to keep
checking that the result is not null.  Similar to the exception when you
expect one row, and get many.

Eric

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>