Binary Large Object (BLOB) is a data type used to store values that do not correspond to other types such as numbers, strings, or dates. Java fields whose types implement java.io.Serializable or are represented as byte can be stored as BLOBs.
If a CMP field is defined as Serializable, it is serialized into a byte before being stored in the database. Similarly, the value fetched from the database is deserialized. However, if a CMP field is defined as byte, it is stored directly instead of being serialized and deserialized when stored and fetched, respectively.
To enable BLOB support in the Enterprise Server environment, define a CMP field of type byte or a user-defined type that implements the java.io.Serializable interface. If you map the CMP bean to an existing database schema, map the field to a column of type BLOB.
For a list of the JDBC drivers currently supported by the Enterprise Server, see the Sun GlassFish Enterprise Server v2.1.1 Release Notes. For configurations of supported and other drivers, see Configurations for Specific JDBC Drivers in Sun GlassFish Enterprise Server v2.1.1 Administration Guide.
For automatic mapping, you might need to change the default BLOB column length for the generated schema using the schema-generator-properties element in sun-ejb-jar.xml. See your database vendor documentation to determine whether you need to specify the length. For example:
<schema-generator-properties> <property> <name>Employee.voiceGreeting.jdbc-type</name> <value>BLOB</value> </property> <property> <name>Employee.voiceGreeting.jdbc-maximum-length</name> <value>10240</value> </property> ... </schema-generator-properties>