• Post Reply Bookmark Topic Watch Topic
  • New Topic

when to use stateless and stateful session bean?

 
gopal kishan
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

i dont know when to use stateless session bean , and when to use stateful session bean?

I read all the document . Its show to maintain client state we need to have stateful. but i am not clear because i can maintain the client details in HttpSession.


please clarify my doubt withh an example. i could not find the real difference between these two...

thanks in advance.
GK
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Gopal,


I read all the document . Its show to maintain client state we need to have stateful. but i am not clear because i can maintain the client details in HttpSession.

Usually is more efficient to maintain client state in HttpSession, especially in a clustered environment. This mainly because the containers can replicate the HttpSession data across the cluster more efficiently than it replicates the SFSB data. However there are situation when an application needs to maintain RMI clients as well, which obviously don't send http request. Finally I'll remind you that SFSB are usually avoided, especially because they are not pooled and could waste a lot of system resources. SLSB on the other hand are very efficient and could be used with HttpSession objects very successfully, if your app requires only http clients.
Regards.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!