I ended up using my own datatype similar to what has been done with String->Clob in Oracle. Source for anyone interested:
Code:
import java.sql.Blob;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Types;
import net.sf.hibernate.Hibernate;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.UserType;
public class StringBlobType implements UserType {
public int[] sqlTypes()
{
return new int[] { Types.BLOB };
}
public Class returnedClass()
{
return String.class;
}
public boolean equals(Object x, Object y)
{
return (x == y)
|| (x != null
&& y != null
&& (x.equals(y)));
}
public Object nullSafeGet(ResultSet rs, String[] names, Object owner)
throws HibernateException, SQLException
{
Blob blob = rs.getBlob(names[0]);
byte[] array = blob.getBytes(1, (int)blob.length());
return new String(array);
}
public void nullSafeSet(PreparedStatement st, Object value, int index)
throws HibernateException, SQLException
{
st.setBlob(index, Hibernate.createBlob(((String)value).getBytes()));
}
public Object deepCopy(Object value)
{
if (value == null) return null;
return new String((String) value);
}
public boolean isMutable()
{
return false;
}
}