• Post Reply Bookmark Topic Watch Topic
  • New Topic

store state info in session or stateful bean?

 
Yan Lee
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:
We can store session information both in the presentation tier and in using stateful beans.
. What are the pros and cons of using either?
. What are the deciding factors that determine using one over the other?
Thanks in advance.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by p intelli:
We can store session information both in the presentation tier and in using stateful beans.
. What are the pros and cons of using either?
. What are the deciding factors that determine using one over the other?

I would say the pros and cons (and thus, the decision) comes down to the level of coupling. Storing session state on the web tier is easier to do and often performs better. However, if you're expecting a range of different kind of presentation tiers for your application, it's better to use stateful session beans for storing session state because otherwise you'd need to duplicate the HttpSession utility for each new presentation tier without such functionality.
You really should read Peter Zadrozny's article, HTTP Session Object vs Stateful EJB, in which he shows that for one setup the performance difference of the different approaches was in fact negligible (thus, implying that it's better to go with a stateful session bean as it costs no more than the more limited alternative).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!