Re: ResultSet.getClob() causing problems when used with JPA's @Lob - Mailing list pgsql-jdbc

From Oliver Jowett
Subject Re: ResultSet.getClob() causing problems when used with JPA's @Lob
Date
Msg-id 4D5260F0.9000908@opencloud.com
Whole thread Raw
In response to Re: ResultSet.getClob() causing problems when used with JPA's @Lob  (Andreas Joseph Krogh <andreak@officenet.no>)
List pgsql-jdbc
Andreas Joseph Krogh wrote:
> On 02/09/2011 01:20 AM, Kris Jurka wrote:

>> The problem is that we have no idea what someone might want to do with a
>> CLOB after they've fetched it.  You're coming from the idea that all
>> they want to do is read it and copy the data out to a String.  From that
>> perspective it's not hard to have a Clob wrapper around a String, but
>> what happens when they say clob.setString(13, "data")?  Are we going to
>> try and figure out what row of what table that varchar column is coming
>> from and do a partial update on it?

> So, I think clob.setString(index, data) should behave just like
> StringBuilder.insert(int offset, String str) except overwrite existing
> data instead of moving the characters above the position.

You really missed Kris' point here - the question is not "how should we
modify the data?" but "how do we locate the data to modify in the first
place?". Consider:

  SELECT somedatacolumn FROM sometable WHERE complex condition

Now you have a resultset with one column. It's a varchar. The caller
calls ResultSet.getClob().setString(). What does the driver do?
Synthesize an UPDATE statement? How? With what parameters?

Oliver

pgsql-jdbc by date:

Previous
From: Radosław Smogura
Date:
Subject: Re: UDT arrays
Next
From: Florian Weimer
Date:
Subject: Re: Connecting over UNIX domain sockets