I'm having a problem when swtching from MySQL: where everything works, to SQLServer 2000 where hibernate seems to be having a problem with a particular "image" column.
I use a UserType to map the blob (BinaryBlobType) which I stole from one of the other postings here. In this case it perfectly in MySQL but not in SQLServer. Strangely, for another class that also maps an image/blob, it works perfectly in both places!
However for this particular mapping I get a SQL Exception saying the amount of data in the stream is not the same as the length set. This is the method in BinaryBlobType where the exception is being thrown:
Code:
public Object nullSafeGet(ResultSer rs, String[] name, Object owner) throws HibernateException, SQLException
{
Blob blob = rs.getBlob(names[0]);
return blob.getBytes(1, (int)blob.length());
}
As I say, this works perfectly for another class that has a column mapped to an image column, and it works in both cases on MySQL but not on SQLServer.
This is the mapping:
Code:
<property name="content" type="BinaryBlobType">
<column name="fileContent"/>
</property>
What gets stranger is if I comment out this mapping then I get another, equally inexplicable error for another class (just to re-iterate this works PERFECTLY with MySQL) that cglib can't find a setter for FileLenght : despite the fact there is a setFileLength method, that's public and takes the correct type. (Well let's face it, it wouldn't work with MySQL either if it wasn't now would it??).
The only difference between connecting to SQLServer and MYSQL is the driver (jtds for SQLServer). But, again, this same mapping works fine in another class.
Help!