|
|
|
Looking at the forums, it seems that the MSSQLDelegate is unnecessary and MSSQL users can go back to using StdJdbcDelegate?
the problem is in StdJdbcDelegate itself. Prepared statement receives byte[] argument when there is no data to be saved. StdJdbcDelegate is only checking blob for null but not for empty Blob object. I solved it by subclassing StdJdbcDelegate and overriding protected Object getObjectFromBlob(ResultSet rs, String colName) throws ClassNotFoundException, IOException, SQLException{
Blob blobLocator = rs.getBlob(colName); if (blobLocator == null || blobLocator.length() == 0){ return null; } return super.getObjectFromBlob(rs, colName); } added check for empty (but non-null) blob.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Jasper Rosenberg had suggested most of the changes on the forums, but the pieces didn't fit together (insertTrigger was creating a byte array while getJobDetailFromBlob was reading a binary stream). After looking at the original StdJDBCDelegate and MSSQLDelegate, it seems that this "binary stream on one side and byte array on the other" is present. That might be the cause of the problem in the related bugs. My fix simply makes getJobDetailFromBlob read a byte array instead of a binary stream from the column (in addition to Jasper's extra nullity checks).
I hope it helps.