db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nikhil G. Daddikar" <...@celoxis.com>
Subject Criteria doesn't work with PG 8.0 (although works with PG 7.3)
Date Thu, 09 Jun 2005 07:48:57 GMT

If you have the following simple criteria:

Criteria c = new Criteria();
c.add("work.percent_complete", 100, c.LESS_THAN);

it doesn't work on PG 8.0 but works on 7.3.

The reason is that in Criterion.appendPsTo, it calls:

    params.add (value.toString());

and consequently on the preparedStatement setString is called.

Read this for more info: 
http://archives.postgresql.org/pgsql-jdbc/2005-03/msg00060.php

In PG 7.3, the protocal version is V2 while in 8.0 is V3. In fact you 
can still get the stuff to work in 8.0 if you specify 
"protocolVersion=2" in the jdbc URL. However, I think this is a serious 
issue and  is not a long term solution and might break other databases 
in the future.

SOLUTION:
I think the solution is not to call the "toString" in appendPsTo AND use 
setObject in the prepared statement. I don't know if this works with all 
databases.












Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message