The BooleanValueObject replaces booleans with integers.
Some databases (ahem, postgres) throw an error when you true and compare an integer and a boolean.
So the java code:
query.addCondition(BinaryCondition
.equalTo(aCol, true));
evaluates to
(myTable.myCol = 1)
which causes postgres to complain:
ERROR: operator does not exist: boolean = integer
I can fix this with:
query.addCondition(BinaryCondition
.equalTo(aCol, new CustomSql(true)));
but it would be nice to override this, somehow.
Rich MacDonald
(Same guy who posted the CTE question the other day.)
Yeah, boolean is a bit of a mess in sql. looks like boolean support is very uneven among the various major dbs. i think oracle was the db we were using when we originally wrote SqlBuilder, and oracle has no boolean data type. Unfortunately, SqlBuilder doesn't have any notion of a dialect, so it's not clear what the best solution is here. Obivously, the SQL 92 spec compliant solution is TRUE and FALSE.
I added the system property "com.healthmarketscience.sqlbuilder.useBooleanLiterals" which, if enabled, will cause sqlbuilder to use sql boolean literals TRUE and FALSE instead of 1 and 0.
fixed in trunk, will be in the 2.1.2 release.