I've got to the bottom of my problem now and I don't know whether its a bug
in Torque or whether I am doing something wrong.

What the cause of the problem was that although my project xml file had
defined the key field as an INTEGER the database actually had the field as a
SMALLINT.  I inherited the system so I guess the database was not generated
from the xml file and the resulting SQL.

The problem I have found though is that whenever you specify a key field as
a SMALLINT you lose the data in the peer record because the populateObject
method uses asBigDecimal to populate the NumberKey object and it fails if
the data type is SMALLINT.

This has come in version 2 of the tdk because prior to that it didn't have
the concept of numberKeys.

Any ideas what I can do besides converting all my SMALLINTs in the database
to INTEGER?  

Regards

Shaun

-----Original Message-----
From: Shaun Campbell [mailto:[EMAIL PROTECTED]]
Sent: 15 June 2001 15:49
To: '[EMAIL PROTECTED]'
Subject: RE: Losing key field data (was Torque problem)


I've just checked with the version of our application running under
tdk1.1a13 and the om classes generated didn't use key objects and the
equivalent Integer field came out correctly as 

        obj.setDay(row.getValue(offset+1).asInt());

in the row2object method.

So between tdk1.1a13 and tdk2.1b4 something changed when generating the om
classes, in terms of how the two key fields are dealt with.

HTH

Shaun

-----Original Message-----
From: Shaun Campbell 
Sent: 15 June 2001 15:28
To: '[EMAIL PROTECTED]'
Subject: RE:Losing key field data (was Torque problem)


Eric

Thanks for that you were correct.  Unfortunately,that doesn't seem to be the
cause of my problem.  

It seems that if my column has two fields identified as the key, the second
one, if defined as an Integer, tries to create a NumberKey by getting the
value from the record as a bigDecimal, resulting in a null NumberKey object.


If the table has just one key field, which is defined as an Integer, then
the application gets the value from the database okay.    

I can't seem to find whereabouts in the code this mapping takes place.  I
don't suppose you can shed any light on this?

Thanks

Shaun

-----Original Message-----
From: Eric Dobbs [mailto:[EMAIL PROTECTED]]
Sent: 11 June 2001 23:19
To: [EMAIL PROTECTED]
Subject: Re: Torque problem


On Monday, June 11, 2001, at 09:46  AM, Shaun Campbell wrote:

> I don't seem to have a db.props in my conf directory, only what looks 
> like
> lots of defaults in my build directory.

Earlier in the thread you mentioned you're using the TDK.
The path Jason specified isn't in WEB-INF/conf in the TDK.

But you can find it in a couple places.  TDK uses items
from the tdk/share directory when generating the sample
application.  So you can find the master db.props file for
your database here:
tdk/share/conf/torque/templates/sql/base/<db>/db.props

And since you already have an installed application, you
will also find the operative db.props file here:
tdk/webapps/<app>/WEB-
INF/build/bin/torque/templates/sql/base/<db>/db.props

-Eric

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

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

Reply via email to