Re: Inserting "null" not working (Sun App Server, Postgres, EJB3)? - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: Inserting "null" not working (Sun App Server, Postgres, EJB3)?
Date
Msg-id 0DC8A2E6-BB3C-4592-BF9E-7EECA0CCE37B@fastcrypt.com
Whole thread Raw
In response to Re: Inserting "null" not working (Sun App Server, Postgres, EJB3)?  ("Heiko W.Rupp" <heiko.rupp@redhat.com>)
Responses Re: Inserting "null" not working (Sun App Server, Postgres, EJB3)?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-jdbc
Heiko,

The reason that setNull is required is because the type information
is required. NULL by it self has no type information. The jdbc driver
binds values to a prepared statement and the type information is
required. So setNull( n, typeinfo) is required to bind the correct type.

Why else would setNull even exist ?

Dave
On 1-Mar-07, at 3:48 PM, Heiko W.Rupp wrote:

> 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
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: explain analyze is your friend
>


pgsql-jdbc by date:

Previous
From: "Heiko W.Rupp"
Date:
Subject: Re: Inserting "null" not working (Sun App Server, Postgres, EJB3)?
Next
From: Tom Lane
Date:
Subject: Re: Inserting "null" not working (Sun App Server, Postgres, EJB3)?