Re: Hibernate + setObject() + boolean problem with a patch - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: Hibernate + setObject() + boolean problem with a patch
Date
Msg-id Pine.BSO.4.56.0502181519410.24216@leary.csoft.net
Whole thread Raw
In response to Hibernate + setObject() + boolean problem with a patch  (Kalle Kivimaa <kalle.kivimaa@iki.fi>)
List pgsql-jdbc

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


pgsql-jdbc by date:

Previous
From: bkafka@xmission.com
Date:
Subject: jdbc and windows
Next
From: John R Pierce
Date:
Subject: Re: jdbc and windows