pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Hibernate + setObject() + boolean problem with a patch
2+ messages / 2 participants
[nested] [flat]

* Hibernate + setObject() + boolean problem with a patch
@ 2005-02-18 10:39 Kalle Kivimaa <kalle.kivimaa@iki.fi>
  2005-02-18 20:24 ` Re: Hibernate + setObject() + boolean problem with a patch Kris Jurka <books@ejurka.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Kalle Kivimaa @ 2005-02-18 10:39 UTC (permalink / raw)
  To: pgsql-jdbc

-- 
* Sufficiently advanced magic is indistinguishable from technology (T.P)  *
*           PGP public key available @ http://www.iki.fi/killer           *

Attachments:

setobject.patch (text/x-patch, 657B) download 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:
^ permalink raw reply [nested|flat] 2+ messages in thread

* Re: Hibernate + setObject() + boolean problem with a patch
  2005-02-18 10:39 Hibernate + setObject() + boolean problem with a patch Kalle Kivimaa <kalle.kivimaa@iki.fi>
@ 2005-02-18 20:24 ` Kris Jurka <books@ejurka.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Kris Jurka @ 2005-02-18 20:24 UTC (permalink / raw)
  To: Kalle Kivimaa <kalle.kivimaa@iki.fi>; +Cc: 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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-02-18 20:24 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-02-18 10:39 Hibernate + setObject() + boolean problem with a patch Kalle Kivimaa <kalle.kivimaa@iki.fi>
2005-02-18 20:24 ` Kris Jurka <books@ejurka.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox