From: Oliver Jowett <oliver@opencloud.com>
To: Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: Exception in Boolean to int2 conversion in xwiki??
Date: Mon, 10 Oct 2005 19:26:03 +1300
Message-ID: <434A097B.2010605@opencloud.com> (raw)
In-Reply-To: <1128921723.6292.23.camel@Panoramix>
References: <1128921723.6292.23.camel@Panoramix>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: oliver@opencloud.com, J.Kraaijeveld@Askesis.nl
Subject: Re: Exception in Boolean to int2 conversion in xwiki??
In-Reply-To: <434A097B.2010605@opencloud.com>
References: <1128921723.6292.23.camel@Panoramix> <434A097B.2010605@opencloud.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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