Debugging a BLOB issue on H2 (different issue than this) led me to try Derby, which fails
even earlier.
This is the same test as org.hibernate.ejb.test.lob.BlobTest, if someone could run this on
Derby, you should see the exception. I've copied the test 1:1 into my environment and
had the same exception.
The sql.BlobTypeDescriptor.STREAM_BINDING option is used by default for an @Lob
java.sql.Blob property. This option "unwraps" the value by calling
java.BlobTypeDescriptor.unwrap():
return (X) new BinaryStreamImpl( DataHelper.extractBytes( value.getBinaryStream() ) );
This crashes on the call to value.getBinaryStream():
Caused by: java.sql.SQLException: You cannot invoke other java.sql.Clob/java.sql.Blob
methods after calling the free() method or after the Blob/Clob's transaction has been
committed or rolled back.
at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.newEmbedSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedConnection.newSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.ConnectionChild.newSQLException(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedBlob.checkValidity(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedBlob.getBinaryStream(Unknown Source)
at
org.hibernate.type.descriptor.java.BlobTypeDescriptor.unwrap(BlobTypeDescriptor.java:123)
Bug report?