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

From Kalle Kivimaa
Subject Hibernate + setObject() + boolean problem with a patch
Date
Msg-id 87psyy884o.fsf@kaylee.killeri.net
Whole thread Raw
Responses Re: Hibernate + setObject() + boolean problem with a patch  (Kris Jurka <books@ejurka.com>)
List pgsql-jdbc
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).

--
* Sufficiently advanced magic is indistinguishable from technology (T.P)  *
*           PGP public key available @ http://www.iki.fi/killer           *
Index: org/postgresql/jdbc2/AbstractJdbc2Statement.java
===================================================================
RCS file: /usr/local/cvsroot/pgjdbc/pgjdbc/org/postgresql/jdbc2/AbstractJdbc2Statement.java,v
retrieving revision 1.72
diff -u -r1.72 AbstractJdbc2Statement.java
--- org/postgresql/jdbc2/AbstractJdbc2Statement.java    16 Feb 2005 18:28:45 -0000    1.72
+++ org/postgresql/jdbc2/AbstractJdbc2Statement.java    18 Feb 2005 10:38:44 -0000
@@ -982,6 +982,7 @@
             oid = Oid.TIMESTAMPTZ;
             break;
         case Types.BIT:
+        case Types.BOOLEAN:
             oid = Oid.BOOL;
             break;
         case Types.BINARY:

pgsql-jdbc by date:

Previous
From: "Matt Magoffin"
Date:
Subject: Statement setNull for Types.CLOB
Next
From: Kris Jurka
Date:
Subject: Re: Statement setNull for Types.CLOB