Skip site navigation (1) Skip section navigation (2)

Re: Exception in Boolean to int2 conversion in xwiki??

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Joost Kraaijeveld <J(dot)Kraaijeveld(at)Askesis(dot)nl>
Cc: "pgsql-jdbc(at)postgresql(dot)org" <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Exception in Boolean to int2 conversion in xwiki??
Date: 2005-10-10 06:26:03
Message-ID: 434A097B.2010605@opencloud.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
Joost Kraaijeveld wrote:

> 2005-10-10 06:03:24,657 ERROR [org.hibernate.util.JDBCExceptionReporter]
> ERROR: column "xwp_unmodifiable" is of type smallint but expression is
> of type boolean

> Does this mean that it is not possible to convert a Java Boolean to a
> PostgreSQL int2 according to the driver or am I reading the exception
> text wrong? 

> If I am reading the exception text correct, doesn't the JDBC spec
> specify a mapping from Boolean to smallint (according to Appendix B,
> table B-5)?

Table B-5 says that you can do "setObject(n, new Boolean(value), 
Types.SMALLINT)" and the driver will convert the Boolean to a SMALLINT. 
See section 13.2.2.2 ("Type Conversions Using the Method setObject") in 
the spec.

As far as I know, the driver supports this case correctly.

I suspect that Hibernate is using setBoolean(), or passing a Boolean to 
the setObject() variant that does not take a Types constant. In both of 
these cases the driver will pass the parameter to the backend typed as a 
boolean, which will produce an error like the above if actually needs to 
be some other type.

-O

In response to

pgsql-jdbc by date

Next:From: Russell FrancisDate: 2005-10-10 12:59:31
Subject: Re: queries against CIDR fail against 8.0.3?
Previous:From: Joost KraaijeveldDate: 2005-10-10 05:22:03
Subject: Exception in Boolean to int2 conversion in xwiki??

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group