I use embedded derby as my database, but when I save a Blob to DB, it throw the following exception, I am wandering how to solve the matter. It looks the BLOB only 255 bytes. How can I save a 64k bytes to the BLOB column.

 

Caused by: java.sql.SQLException: A truncation error was encountered trying to shrink BLOB 'XX-RESOLVE-XX' to length 255.

    at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)

    at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)

    at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)

    at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)

    at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)

    at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown Source)

    at org.apache.derby.impl.jdbc.EmbedStatement.executeStatement(Unknown Source)

    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeStatement(Unknown Source)

    at org.apache.derby.impl.jdbc.EmbedPreparedStatement.executeUpdate(Unknown Source)

    at org.hibernate.jdbc.NonBatchingBatcher.addToBatch(NonBatchingBatcher.java:23)

    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2197)

    ... 69 more