-----Original Message-----
From: Horvath, Tibor
Sent: Tuesday, July 20, 2004 4:45 PM
To: Horvath, Tibor; Knutson, Mick
Subject: RE: http://e-docs.bea.com/wls/docs61/ejb/cmp.html#1061636
-----Original Message-----
From: Horvath, Tibor
Sent: Tuesday, July 20, 2004 3:02 PM
To: Knutson, Mick
Subject: http://e-docs.bea.com/wls/docs61/ejb/cmp.html#1061636
BLOB and CLOB DBMS Column Support for the Oracle DBMS
WebLogic Server supports Oracle Binary Large Object (BLOB) and
Character
Large Object (CLOB) DBMS columns with EJB CMP. BLOBs and CLOBs are
data
types used for efficient storage and retrieval of large objects.
CLOBs are
string or char objects; BLOBs are binary or serializable objects such
as
pictures that translate into large byte arrays.
BLOBs and CLOBs map a string variable, a value of OracleBlob or
OracleClob, to a BLOB or CLOB column. WebLogic Server maps CLOBs only
to
the data type java.lang.string. At this time, no support is available
for
mapping char arrays to a CLOB column.
To enable BLOB/CLOB support:
In the bean class, declare the variable.
Edit the XML by declaring the dbms-column-type deployment descriptor
in the weblogic-cmp-rdbms jar.xml file.
Create the BLOB or CLOB in the Oracle database.
Using BLOB or CLOB may slow performance because of the size of the
BLOB or
CLOB object.
Specifying a BLOB Using the Deployment Descriptor
The following XML code shows how to specify a BLOB object using the
dbms-column element in weblogic-cmp-rdbms-jar-xml file.
Figure 5-2 Specifying a BLOB object
<field-map>
<cmp-field>photo</cmp-field>
<dbms-column>PICTURE</dbms-column>
<dbms_column-type>OracleBlob</dbms-column-type>
</field-map>
Controlling Serialization of cmp-fields Mapped to OracleBlobs
By default, when WebLogic Server writes and reads a cmp-field of type
byte[] that is mapped to an OracleBlob, it serializes and
deserializes the
field, respectively.
Mick,
This and the previous message came from searching the BEA web site.
Do you have this covered?
The clob(4000) seems to be a red herring. All clobs show up as 4000
on
Oracle DESCRIBE command.
Tibor
If WebLogic Server reads a BLOB that was written directly to the
database
by another program, errors can result, because the container assumes
that
the data is serialized.
To specify that the data is not serialized, compile the EJB with this
flag:
java -Dweblogic.byteArrayIsSerializedToOracleBlob=false
weblogic.ejbc std_ejb.jar ejb.jar
Specifying a CLOB Using the Deployment Descriptors
The following XML code shows how to specify a CLOB object using the
dbms-column element in the weblogic-cmp-rdbms-jar-xml file.
Figure 5-3 Specifying a CLOB object
<field-map>
<cmp-field>description</cmp-field>
<dbms-column>product_description</dbms-column>
<dbms_column-type>OracleClob</dbms-column-type>
</field-map>