On Nov 28, 2004, at 4:49 PM, Jeremy Boynes wrote:

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.
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?

LOBs in general are not very portable, especially with Oracle.

The problem with setBlob() is that you need to have the driver create an instance for you - you can't just pass in a class that implements that interface. That usually involves executing the insert/update statement with vendor specific SQL and then obtaining a LOB locator either via another select or by using something like Oracle's insert/returning.

Looks like you can do this without Oracle's specific sql or classes starting with 8.15 and the JDBC 3 drivers.


http://www.oracle.com/technology/tech/java/jroadmap/jdbc/ listing.htm#998520

I think there is still oracle specific sql for inserting a new empty blob (empty_blob() maybe).

-dain



Reply via email to