wood burning stoves 2.0*
The moose likes Oracle/OAS and the fly likes inserting blob with CMP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "inserting blob with CMP" Watch "inserting blob with CMP" New topic
Author

inserting blob with CMP

marc de toutophone
Greenhorn

Joined: Jul 16, 2003
Posts: 4
hello
i'm using oracle database 9iAs and
oc4j application server.
in my application, i need to insert
a blob in the database.
the ejb entities is a cmp.
i implement the blob interface
but when i use setBlob(Blob b)
i have no error but the blob in
the database is null.
why?
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
toutophone toutophone,
Thanks for joining JavaRanch, but could you take a quick look at the naming policy and edit your profile accordingly.
Now about your question...
First you will want to check to make sure your Application Server supports Blobs in CMP. Then you will need to read up on how this mapping is implemented (for example WebLogic maps Blobs to byte arrays). Basically, this is going to be a vendor specific extension. Since you are using Oracle AS, I am going to move this post to the Oracle/OAS Forum for further discussion.
Sujatha Ranganathan
Greenhorn

Joined: May 29, 2003
Posts: 12
Hi,
You cannot use Blobs directly as fields in CMP EJB, since Blob is really an open cursor to the database, and it is not serializable.
Here's a How-to on using Blobs
http://otn.oracle.com/tech/java/oc4j/904/content_preview.html
You can see the code for this at the end of the page
http://otn.oracle.com/tech/java/oc4j/904/how_to/how-to-ejb-cmpblob.zip
Hope this helps,
Sujatha.
http://otn.oracle.com/sample_code/content.html
marc de toutophone
Greenhorn

Joined: Jul 16, 2003
Posts: 4
hi,
thanks for your help
i try to insert the blob, there is no
error messsage, so i think its ok
but there is no blob in table.
did you have the same probleme?
marc
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: inserting blob with CMP
 
Similar Threads
string to blob-please help
BMP / CMP Entity Bean?
Mapping String To CLOB datatype using WSAD 4.0
Blobs and CMPs
storing images in the database