From: Radosław Smogura <rsmogura@softperience.eu>
To: pgsql-jdbc@postgresql.org
Cc: Andreas Joseph Krogh <andreak@officenet.no>
Subject: Re: ResultSet.getClob() causing problems when used with JPA's @Lob
Date: Mon, 7 Feb 2011 22:38:42 +0100
Message-ID: <201102072238.42274.rsmogura@softperience.eu> (raw)
In-Reply-To: <4D505B02.804@officenet.no>
References: <201102070001.22259.andreak@officenet.no>
<201102070911.20245.rsmogura@softperience.eu>
<4D505B02.804@officenet.no>
PostgreSQL doesn't have field type CLOB, nor BLOB.
If eveny it would be possible for driver to read CLOB from varchar, driver
will be unable to set proper value when calling UPDATE or INSTERT. It is due
to internal way how PSQL deals with those values.
I know drivers supports custom casting, but casting from varchar to clob is
implicite prohibted in JDBC. If you look at B-6 table x indicates possible
casting. There is no x, nor X on varchar cross clob
Kind regards,
Radosław Smogura
Andreas Joseph Krogh <andreak@officenet.no> Monday 07 February 2011 21:50:10
> On 02/07/2011 09:11 AM, Radosław Smogura wrote:
> > Hi,
> > PGSQL doesn't have CLOB type, instead JDBC uses LOB, but PGSQL doesn't
>
> have
>
> > "clear" lob field type. It uses in table column with type OID, and
>
> supporting
>
> > table for storing large objects.
> >
> > Look at bug submited by me
> > http://opensource.atlassian.com/projects/hibernate/browse/HHH-4617
> > Should be fixed in 3.6.1 release.
>
> I'm experiencing this with 3.6.1 so whatever that issue fixes,
> MaterializedClobType (which is the default type Hibernate uses when it
> sees @Lob on String-types) still uses ClobTypeDescriptor, which again
> has this code:
>
> protected X doExtract(ResultSet rs, String name, WrapperOptions options)
> throws SQLException {
> return javaTypeDescriptor.wrap( rs.getClob( name ), options );
> }
>
> And it should be able to call rs.getClob().
>
> It's not clear to me why the JDBC-driver for PG shouldn't just use
> rs.getString() internally for getClob() calls? Requiring
> special-handling in Hibernate for dealing with Strings by setting an
> obscure property just doesn't seem right. And I don't want to set a
> property to handle CLOB which might affect how I use BLOBs.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: rsmogura@softperience.eu, andreak@officenet.no
Subject: Re: ResultSet.getClob() causing problems when used with JPA's @Lob
In-Reply-To: <201102072238.42274.rsmogura@softperience.eu>
References: <201102070001.22259.andreak@officenet.no> <201102070911.20245.rsmogura@softperience.eu> <4D505B02.804@officenet.no> <201102072238.42274.rsmogura@softperience.eu>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox