my dog learned polymorphism*
The moose likes EJB and other Java EE Technologies and the fly likes Diff between HttpSession and Stateful Session bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Diff between HttpSession and Stateful Session bean" Watch "Diff between HttpSession and Stateful Session bean" New topic
Author

Diff between HttpSession and Stateful Session bean

sitaram irrinki
Ranch Hand

Joined: Feb 16, 2005
Posts: 158
What is the difference between using a HttpSession & a Stateful
Session bean ? Why can't HttpSession be used instead of Session bean
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Sitaram,


Why can't HttpSession be used instead of Session bean

If your app needs to support RMI clients then obviously you cannot use the HttpSession and SFSBs might be an acceptable solution.

What is the difference between using a HttpSession & a Stateful
Session bean ?

They were both design to do the same, but HttpSession is for web applications a better choice. One reason behind this is that the container can optimize the way the HttpSession data is replicated across the cluster, in a better way than SFSB data. The algorithm is very simple: with HttpSessions the container knows what data got changed, tracing the setAttribute calls. Hence when is about replicating the information to other servers in the cluster the container won�t replicate the whole HttpSession data, but only the changed data. As for SFSB the container has no way to figure out which data was change and the whole session information get replicated any time it changes.
Regards.


I think, therefore I exist -- Rene Descartes
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Diff between HttpSession and Stateful Session bean