X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8BCA18BA26E for ; Fri, 18 Feb 2005 10:39:22 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56947-10 for ; Fri, 18 Feb 2005 10:39:17 +0000 (GMT) Received: from killer.killeri.net (d108.fi.basen.net [212.226.212.108]) by svr1.postgresql.org (Postfix) with ESMTP id EF7F98BA25B for ; Fri, 18 Feb 2005 10:39:18 +0000 (GMT) Received: by killer.killeri.net (Postfix, from userid 1000) id B9F3698672; Fri, 18 Feb 2005 12:39:19 +0200 (EET) To: pgsql-jdbc@postgresql.org Subject: Hibernate + setObject() + boolean problem with a patch Content-Transfer-Encoding: 8bit From: Kalle Kivimaa Organization: MikaVaan School of Flying X-Home-Page: http://killeri.net Date: Fri, 18 Feb 2005 12:39:19 +0200 Message-ID: <87psyy884o.fsf@kaylee.killeri.net> User-Agent: Gnus/5.110002 (No Gnus v0.2) XEmacs/21.4 (Jumbo Shrimp, linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.868 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200502/125 X-Sequence-Number: 12305 --=-=-= 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 * --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=setobject.patch 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: --=-=-=--