The problem happened whenever I use an boolean value inside a Criteria object. Besides save(), any filtered select had the same problem.

I solved it by modifing the BDPostgres.java file. Is this a bug?

I still can insert, select like before.

Luiz Angelo Daros de Luca

*************** public class DBPostgres extends DB

*** 180,185 ****

*/

public String getBooleanString(Boolean b)

{

! return (b == null) ? "0" : (Boolean.TRUE.equals(b) ? "1" : "0");

}

}

--- 181,186 ----

*/

public String getBooleanString(Boolean b)

{

! return (b == null) ? "'0'" : (Boolean.TRUE.equals(b) ? "'1'" : "'0'");

}

}


Bogdan Vatkov escreveu:


Suggestion:
You might try to use javaType="object" for the boolean field just to see how
torque will handle it.

regrads,
Bogdan
----- Original Message -----
From: "Luiz Angelo Daros de Luca" <[EMAIL PROTECTED]>
To: "Apache Torque Users List" <[EMAIL PROTECTED]>
Sent: Monday, January 19, 2004 21:22
Subject: PostgreSQl don't delete rows with BOOELAN type




Hello,

   I have an table with a BOOLEAN type and when I ask torque to delete
it, it generates a buggy SQL query.


DELETE FROM XXX WHERE blField = 0


The correct query in postgres would be

DELETE FROM XXX WHERE blField = '0'

or

DELETE FROM XXX WHERE blField = false

or even

DELETE FROM XXX WHERE blField = 'false'

I found out that org.apache.torque.adapter.DBPostgres return string "0"
for False/NULL and "1" for true

Any ideas?

Thanks

Luiz Angelo Daros de Luca


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