This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Difference between using Session Scope or Stateful Session Bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Difference between using Session Scope or Stateful Session Bean" Watch "Difference between using Session Scope or Stateful Session Bean" New topic
Author

Difference between using Session Scope or Stateful Session Bean

Jörg Beck
Greenhorn

Joined: Sep 30, 2009
Posts: 4
Hi,

I've problems to understand when to use the session scope or use a stateful session bean to maintain a conversational state (example: online-shop-cart).
How are those scopes (session, page, request and application) realized under the hood in Java EE?

Thanks in advance
Jörg
ntumba lobo
Ranch Hand

Joined: Oct 21, 2008
Posts: 180
Both the session scope and the SFSB allow to keep user specific data across multiple requests on the server side.
Session scope you can only use it in the context of a web application whereas SFSB is more generic and you can it for web and non-web application.
Usually if you develop a web application serving only web clients you will use the session scope to keep the conversational state, SFSB have a negative impact on perf and scalability.
But if your logic is for web and non-web clients or non-web clients only you will use SFSB.
I hope this clarifies things a bit for you


SCJP 5 , SCWCD 5, SCEA 5
 
 
subject: Difference between using Session Scope or Stateful Session Bean