I have tried several of the approaches described:
1. I created the class BinaryBlobType.
2. I added the Oracle specific BLOB creation since the Oracle code
assumes that any java.sql.Blob they get is an oracle.sql.BLOB which is
not the case if you use Hibernate.createBlob().
As someone has mentioned here, the code won't run if you need jdbc
batches since the above code works with streams.
However, if you don't mind giving up streams and holding the bytes
themselves (which is my case, since I got relatively small byte arrays)
then using :
[code]
public void nullSafeSet(PreparedStatement st, Object value, int index)
throws HibernateException, SQLException {
byte[] bytes = (byte[]) value;
st.setBytes(index, bytes);
}
[/code]
seems to me as the simplest way |