• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

inserting blob with CMP

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic