On Fri, 18 Feb 2005, Kalle Kivimaa wrote:
> We are using Hibernate on top of PostgreSQL and with a recent switch
> to PostgreSQL 8.0 we ran into a problem that trying to insert rows
> with null boolean fields to the DB failed miserably. I traced the
> problem to the fact that Hibernate wants to do this throuhg
> setObject() and this does not handle null booleans. The attached patch
> handles the booleans the same way as bits are handled which I think is
> the correct way (at least it solved our problem).
>
This fix is not correct because the Jdbc2 classes must be compilable by a
1.2 and 1.3 JDKs which do not have Types.BOOLEAN available. A fix of this
kind would need to go into one of the Jdbc3 classes which are only
compiled by >= 1.4 JDKs. I also don't believe your fix is necessary.
org.postgresql.test.jdbc3.TypesTest has the following test in it
pstmt.setObject(2, null, Types.BOOLEAN) and it works fine. Could you be
more clear on what your problem was (with a stacktrace)? If you are using
a jdbc2 version driver then it won't work and you need to use a jdbc3
driver.
Kris Jurka