X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id D07F9D9894 for ; Mon, 10 Oct 2005 03:26:12 -0300 (ADT) 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 51662-03 for ; Mon, 10 Oct 2005 06:26:06 +0000 (GMT) Received: from yass.opencloud.co.nz (yass.opencloud.co.nz [131.203.101.226]) by svr1.postgresql.org (Postfix) with ESMTP id B64D0D9A06 for ; Mon, 10 Oct 2005 03:26:05 -0300 (ADT) Received: from 203-79-104-60.cable.paradise.net.nz ([203.79.104.60] helo=[192.168.0.20]) by yass.opencloud.co.nz with asmtp (TLS-1.0:DHE_RSA_AES_128_CBC_SHA:16) (Exim 4.34) id 1EOr6q-00076X-Ch; Mon, 10 Oct 2005 19:26:04 +1300 Message-ID: <434A097B.2010605@opencloud.com> Date: Mon, 10 Oct 2005 19:26:03 +1300 From: Oliver Jowett User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051009) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Joost Kraaijeveld Cc: "pgsql-jdbc@postgresql.org" Subject: Re: Exception in Boolean to int2 conversion in xwiki?? References: <1128921723.6292.23.camel@Panoramix> In-Reply-To: <1128921723.6292.23.camel@Panoramix> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.008 required=5 tests=[AWL=0.008] X-Spam-Level: X-Archive-Number: 200510/44 X-Sequence-Number: 13975 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