Lasse,
Yes, i checked those documents before asking here.
(NB : There is actually a mistake in the sample provided <dbms_column-type> should be replaced by <dbms-column-type>
It's fine for the deploytement descriptor and how to map data.
Problems come after that, in the EJB Bean.
How to set the Blob values ??
As I said, standard types insert *works*.
You're right Dana, maybe a little bit more of info could help :
- Database Table to be mapped :
OBJ_UNIT_NBR NUMBER (8) NOT NULL,
OBJ_DESC NUMBER (8) NOT NULL,
OBJ_IMG BLOB
The OBJ_IMG is nothing more than a small picture (about 5/6kb)
- Mapping rules as described in the weblogic-cmp-rdbms-jar.xml file
<..>
<table-map>
<table-name>OBJ</table-name>
<field-map>
<cmp-field>ObjectUnitNumber</cmp-field>
<dbms-column>OBJ_UNIT_NBR</dbms-column>
</field-map>
<field-map>
<cmp-field>ObjectDescription</cmp-field>
<dbms-column>OBJ_DESC</dbms-column>
</field-map>
<field-map>
<cmp-field>ObjectPicture</cmp-field>
<dbms-column>OBJ_IMG</dbms-column>
<dbms-column-type>OracleBlob</dbms-column-type>
</field-map>
</table-map>
<..>
I can easily call the ejbCreate method of my EJB Bean (Remote) class with the mandatory parameters : OBJ_UNIT_NBR and OBJ_DESC.
But how to insert the Blob data ??
Looks like Blob data first need to be inserted as 'empty' :
INSERT INTO OBJ (OBJ_UNIT_NBR, OBJ_DESC, OBJ_IMG) VALUES( ?, ?, EMPTY_BLOB())
then selected in order to refer to the Blob to save in database :
SELECT OBJ_IMG FROM OBJ WHERE OBJ_UNIT_NBR = <ObjId> FOR UPDATE
finally transfert data to the Blob :
Blob objImage = objResultSet.getBlob("OBJ_IMG");
OutputStream out = ((weblogic.jdbc.rmi.SerialOracleBlob)objImage).getBinaryOutputStream();
out.write(myArrayOfBytes);
I don't see how to perform the same steps in an Entity EJB....