Reputation: 11
In EJB3, we have two kinds of session beans: Stateful and Stateless. In which case do we have to use the Stateful beans? How does EJB3 manage the session of the stateful session bean? Can we access the session-scoped value of this session bean? And when there are many users access to our application that use stateful session bean, how can the performance of our system be affected?
Upvotes: 1
Views: 525
Reputation: 503
You should only use stateful session beans if you need to keep state between calls. (e.g a shopping cart that accumulates items) Stateless session beans can be pooled and is therefore more effective.
You should always try to keep things stateless, as this is more scalable.
Upvotes: 1