Re: Hibernate + setObject() + boolean problem with a patch

From: Kris Jurka <books(at)ejurka(dot)com>
To: Kalle Kivimaa <kalle(dot)kivimaa(at)iki(dot)fi>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Hibernate + setObject() + boolean problem with a patch
Date: 2005-02-18 20:24:00
Message-ID: Pine.BSO.4.56.0502181519410.24216@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message John R Pierce 2005-02-18 22:20:13 Re: jdbc and windows
Previous Message bkafka 2005-02-18 20:12:07 jdbc and windows