• 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

Streams and EJB

 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I have some pdf data stored in my database which will be of bytes. I want to read that database data and send it to the servlet to display the pdf. Is it feasible enough to use the streams in EJB. I read that we should not be using the File streams in my EJB layer
For e.g in my implementation bean can i have this :
public DataInput getPdf(){
// knows how to query for the pdf and send it to the calling servlet
}
Hari
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if your client and ejb are situated on different machines(multitier environment) streams can't be sent over the network as they are not serialized.in this case you need to convert streams into serialized objects e.g. String etc.which can be easily sent over the network.when you receive this string in your ejb again you need to convert this into bytes and then store it in the database.
while fetching this field do exactly reverse of above procedure.
i've successfully done exactly same...hope this information will help you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic