Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 61E521337BB8 for ; Tue, 5 Oct 2010 08:05:43 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 08713-01 for ; Tue, 5 Oct 2010 11:05:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tremor.opencloud.co.nz (tremor.opencloud.co.nz [131.203.101.230]) by mail.postgresql.org (Postfix) with ESMTP id 353F71337BC5 for ; Tue, 5 Oct 2010 08:05:36 -0300 (ADT) Received: from 121-98-80-66.bitstream.orcon.net.nz ([121.98.80.66] helo=[192.168.1.3]) by tremor.opencloud.co.nz with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1P35Ku-00084p-BJ; Wed, 06 Oct 2010 00:05:32 +1300 Message-ID: <4CAB0677.5080706@opencloud.com> Date: Wed, 06 Oct 2010 00:05:27 +1300 From: Oliver Jowett User-Agent: Thunderbird 2.0.0.24 (X11/20100411) MIME-Version: 1.0 To: stagirus CC: pgsql-jdbc@postgresql.org Subject: Re: [BUGS] Mapping Hibernate boolean to smallint(Postgresql) References: <4CA499DB.8000807@postnewspapers.com.au> <4CA4F536.5050704@opencloud.com> <1285880740264-3047671.post@n5.nabble.com> <4CA503A2.7010706@opencloud.com> <1285883402563-3047721.post@n5.nabble.com> <4CA55A9E.80700@postnewspapers.com.au> <1285971439496-3073409.post@n5.nabble.com> <4CA6929B.5050105@postnewspapers.com.au> <1285995027439-3073605.post@n5.nabble.com> <1286275310520-3199236.post@n5.nabble.com> In-Reply-To: <1286275310520-3199236.post@n5.nabble.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.778 tagged_above=-10 required=5 tests=BAYES_00=-1.9, URI_HEX=1.122 X-Spam-Level: X-Archive-Number: 201010/43 X-Sequence-Number: 21011 stagirus wrote: > Good morning. Please find the attached log file regarding our problem. The > main issue is with "DELETED" column as SMALLINT. Postgres is not accepting > '0' in the values(..) for DELETED column. (This was the original issue that > I posted.) > > http://postgresql.1045698.n5.nabble.com/file/n3199236/PostgresForum.log > PostgresForum.log > ERROR 04-10 15:26:32,937 (JDBCExceptionReporter.java:logExceptions:101) -Batch entry 0 /* insert com.stagirus.subsystem.suppliermaster.domain.Provider */ insert into ST_PROVIDER (GEOGRAPHY_ID, ADDRESS_ID, PROVIDER_NAME, DESCRIPTION, WEBSITE, EMAIL, PHONE, FAXNO, PRIMARY_ORG_ID, DELETED, CREATED_ON, CREATED_BY, LAST_MODIFIED_ON, LAST_MODIFIED_BY, PROVIDER_ID) values ('1', '2', 'supplier1', NULL, NULL, NULL, '1245874123', '', '1', '0', '2010-10-04 15:26:32.734000 +05:30:00', '1', '2010-10-04 15:26:32.734000 +05:30:00', '1', '1') was aborted. Call getNextException to see the cause. Not shown in your logs is the type which Hibernate is binding the parameters as. I expect that the '0' is actually bound with Oid.BOOL because Hibernate is using setBoolean() or setObject(...,Types.BOOLEAN). For example, the implementation of setBoolean does this: > public void setBoolean(int parameterIndex, boolean x) throws SQLException > { > checkClosed(); > bindString(parameterIndex, x ? "1" : "0", Oid.BOOL); > } which means that the value parameter is indeed "0" or "1" - but its type is BOOL. (I'm guessing that the query logged by Hibernate above is the result of PreparedStatement.toString(), which just substitutes the raw parameter values into the query string without respect for their bound types) You could check this by setting loglevel=2 and looking at the messages sent to the backend, or by looking at a packet capture with wireshark (IIRC, it has a decent protocol analyzer for the postgresql FE/BE protocol) Oliver