On 12/01/2011 05:38 PM, Oliver Jowett wrote:
> On 1 December 2011 22:21, Mikko Tiihonen
> <mikko.tiihonen@nitorcreations.com> wrote:
>
>> So far it has been established that the JPA implementation you are
>> using uses an unportable hack that happens to work for some DB vendors
>> but not with postgresql.
>
> While we're at it - what is the JPA implementation in question?
I'd be interested too, as I've had no issues related to null handling
using EclipseLink or Hibernate (3 and 4) with PostgreSQL.
(on a side-note):
I *have* had annoying issues working with the `xml' datatype (and other
text-like types) where I'd like to work with them as String in Java.
This is really a JPA deficiency as much as a PgJDBC one, in that JPA
doesn't really offer a way to say "this is the Java type, but please use
this other SQLTYPE when passing it to the JDBC driver". The JPA
implementation would use setString(...) instead of setObject(...) with
the SQLXML type constant, and Pg would refuse to accept a `text' value
for an `xml' field.
I kind of wish there was an implicit cast from `text' to `xml' since
there's well-formedness checking done anyway, but in this case the real
problem is that JPA doesn't let you specify an explicit JPA type or
override how the value is passed to the JDBC driver. Some specific JPA
implementations offer extensions for this, though.
--
Craig Ringer