geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dain Sundstrom <dsundst...@gluecode.com>
Subject Re: BLOB manipulation - question
Date Mon, 29 Nov 2004 01:41:42 GMT
On Nov 28, 2004, at 3:16 PM, Gianny Damour wrote:

> Hi,
>
> I am working on the support of Dependent Value Classes.
>
> The implementation is rather simple: if a binding is not explicitely 
> defined for a CMP field class (see 
> org.tranql.sql.jdbc.binding.BindingFactory) and if the class 
> implements Serializable, then one assumes that the CMP field is a 
> Dependent Value Class. Such CMP fields are stored into BLOB columns.

I suggest that if the object is not explicitly defined you assume it is 
serializable.  The problem with checking for serializable is the field 
type typically doesn't implement serializable.  For example, people 
often use java.lang.Object for a generic field type.

> The serialized object is stored into the BLOB via the 
> PreparedStatement.setBinaryStream(int parameterIndex, 
> java.io.InputStream x, int length) method. As a matter of fact, this 
> works with Derby. Yet, it seems that this is not the "correct" way. 
> More accurately, it seems that PreparedStatement.setBlob (int i, Blob 
> x) is the "correct" way.
>
> Anyone knows if PreparedStatement.setBinaryStream is portable?

It's been a while, but last time I checked setBinaryStream didn't work 
in oracle for streams bigger then 4k.  IIRC, the right way to update a 
blob is to get a blob object from a result set using getBlob and change 
the new bytes into the blob (truncate it maybe?).  At this point, I 
don't remember what you do... maybe call updateBlob, or set it into an 
update statement.  Anyway, I remember the only portable way was to use 
the LOG objects directly.  I also remember that inserting a new LOB was 
tricky.

Maybe someone that has worked with oracle recently can fill all of us 
in on LOB support in the new oracle drivers.

-dain


Mime
View raw message