Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id C00749FB55F for ; Thu, 1 Mar 2007 17:16:54 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 17712-05 for ; Thu, 1 Mar 2007 17:16:38 -0400 (AST) X-Greylist: delayed 00:28:15.960954 by SQLgrey-1.7.4 Received: from mx1.redhat.com (mx1.redhat.com [66.187.233.31]) by postgresql.org (Postfix) with ESMTP id 9E6619FB527 for ; Thu, 1 Mar 2007 17:16:40 -0400 (AST) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l21KmNCk014849 for ; Thu, 1 Mar 2007 15:48:23 -0500 Received: from pobox.stuttgart.redhat.com (pobox.stuttgart.redhat.com [172.16.2.10]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l21KmMCf009080 for ; Thu, 1 Mar 2007 15:48:22 -0500 Received: from [172.31.7.7] (vpn-4-28.str.redhat.com [10.32.4.28]) by pobox.stuttgart.redhat.com (8.12.11.20060308/8.12.11) with ESMTP id l21KmLAe027944 for ; Thu, 1 Mar 2007 21:48:21 +0100 In-Reply-To: <40939ed60703010604j149caad2n92dccac2ae6f6824@mail.gmail.com> References: <40939ed60703010604j149caad2n92dccac2ae6f6824@mail.gmail.com> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <3AC75FD4-F9DC-4B9E-AA60-38F67EFD39B0@redhat.com> Reply-To: pgsql-jdbc@postgresql.org Content-Transfer-Encoding: 7bit From: "Heiko W.Rupp" Subject: Re: Inserting "null" not working (Sun App Server, Postgres, EJB3)? Date: Thu, 1 Mar 2007 21:48:00 +0100 To: pgsql-jdbc@postgresql.org X-Mailer: Apple Mail (2.752.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/5 X-Sequence-Number: 16719 Hi, Am 01.03.2007 um 15:04 schrieb Ahmed Abd-el-Shafy Abd-Allah: > Internal Exception: org.postgresql.util.PSQLException : ERROR: column > "pools" is of type smallint but expression is of type character > varyingError Code: 0 > > Call:INSERT INTO MYTABLE (POOLS) VALUES (?) > bind => [ null] > Query:InsertObjectQuery(aaacs.rex.ejb.entities.MyTable@10b287f) We have the very same problem with JBoss EJB3 and Postgres. Our "solution" is to get the underlying Hibernate session via EntityManager.getDelegate() and call the setNull() (?) Method from Hibernate for this. So the problem is twofold: - EJB3 being too stupid to have a setNull() method - Postgres JDBC driver not automatically the right thing anyway Heiko -- Heiko W.Rupp heiko.rupp@redhat.com, http://www.dpunkt.de/buch/3-89864-429-4.html