aspose file tools*
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
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
 
Don't get me started about those stupid light bulbs.
 
subject: inserting blob with CMP