Hi René,
back to that old thread...
I was testing an unrelated feature, and noticed that you can't really
mix #result() directives and inline column names in a SQLTemplate. You
have to consistently use one or the other technique. Otherwise (1)
Cayenne will only read a subset of columns that are scripted with
#result(..), ignoring the rest and (2) it will read the values from
incorrect positions in the ResultSet (ouch!). The combination of (1)
and (2) can give really weird results. Maybe this is what's causing
your problem?
On a side note, it is possible to detect this mismatch in the code,
however this requires retrieval of ResultSetMetadata introducing a
small delay to each query. So for now leaving this up to the user to
code SQLTemplate properly.
Andrus
On Feb 25, 2005, at 4:20 AM, René Kulschewski wrote:
>> String sqlStr = "select id, comdeviceevnmeth_id, isacknowledge,
> comdevice_id, "
>> + "#result('txdatetime'
>> 'java.sql.Timestamp'), "
>> + "#result('rxdatetime'
>> 'java.sql.Timestamp'), "
>> + "#result('gpstime'
> 'java.sql.Timestamp'),"
>> + " gpslongitude, gpslatitude, "
>> + "directionofmotion, velocity,
locationangle,
>> locationdescription, "
>> + "locationdistance,
> t.indata.getclobval() indata, "
>> + "#result('creation'
> 'java.sql.Timestamp'), "
>> + "creationby, "
>> + "#result('modification'
>> 'java.sql.Timestamp'), "
>> + "modificationby, isdeleted, "
>> + "comdeviceevnstate_id, tour_id "
>> + "from comdeviceevent t where
>> t.comdeviceevnstate_id=1"
>> + " order by
>> t.comdevice_id,t.txdatetime,t.gpstime";
This archive was generated by hypermail 2.0.0 : Tue Mar 15 2005 - 22:33:50 EST