snowbug wrote:
I don't have much experience with PostgreSql, but here is what the problem is:
The "? is null" can not be used in the prepared statement, you will need to create seperate queries:
Another thing is, from my experience (with Oracle), the setNull() does not work as the way it suppose to be, and there is no workaround. So usually I avoid use setNull().
Please give it a try and let us know if it fixes the problem.
thx for your suggestion.
setNull() do on PostgreSQL. the error may happen over the incompatible of the BigDecimal. i found the following SQL for my prepared statement:
SELECT object_id, amount FROM test WHERE (object_id LIKE ? OR ? IS NULL) AND (amount = ?::numeric(5,2) OR ?::numeric(5,2) IS NULL)
It try to enforce the explicit casting. Though it look strange, it work.