Re: ResultSet.getClob() causing problems when used with JPA's @Lob

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Andreas Joseph Krogh <andreak(at)officenet(dot)no>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: ResultSet.getClob() causing problems when used with JPA's @Lob
Date: 2011-02-09 09:40:00
Message-ID: 4D5260F0.9000908@opencloud.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Florian Weimer 2011-02-09 10:14:56 Re: Connecting over UNIX domain sockets
Previous Message Radosław Smogura 2011-02-09 09:29:28 Re: UDT arrays