The blob field type is being used as a catch-all for multiple binary types.
Right now getting an object from a blob field type could return a byte array, a
deserialized Java object, or a javax.sql.rowset.serial.SerialBlob object. There
is no way to know for sure what will be returned - the entity engine code tries
various methods until one works.
I think it would be better to specify exactly what you intend to store in a
BLOB SQL type: a byte array, a serialized Java object, or some unknown binary
type. So, I propose that we add two new field types: byte-array and object.
Using Derby as an example, this is what it would look like in
fieldtypederby.xml:
<field-type-def type="blob" sql-type="BLOB"
java-type="java.sql.Blob"></field-type-def>
<field-type-def type="byte-array" sql-type="BLOB"
java-type="byte[]"></field-type-def>
<field-type-def type="object" sql-type="BLOB"
java-type="java.lang.Object"></field-type-def>
Getting an object from each field type would return the respective Java object
type.
What do you think?
-Adrian