Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

inserting blob with CMP

 
marc de toutophone
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic