aspose file tools
The moose likes EJB and other Java EE Technologies and the fly likes Streams and EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Reply Bookmark "Streams and EJB" Watch "Streams and EJB" New topic
Author

Streams and EJB

Hari babu
Ranch Hand

Joined: Jun 25, 2001
Posts: 208
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
Manish Kamat
Greenhorn

Joined: Apr 15, 2003
Posts: 8
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.
 
I agree. Here's the link: http://jrebel.com/download
 
subject: Streams and EJB
 
Similar Threads
EJBs and Applets
PDF File storing and retrieving
Servlet to Backing bean
Response as PDF
Showing PDF in a new window