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?
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