I am going through the Java EE 6 tutorial and I am trying to understand the difference between stateless and stateful session beans. If stateless session beans do not retain
The major differences between the two major types of session beans are:
Stateless Beans
- Stateless Session Beans are the ones which have no conversational state with the client which has called its methods. For this reason they can create a pool of objects which can be used to interact with multiple clients.
- Performance wise stateless beans are better since they don't have states per client.
- They can handle multiple requests from multiple clients in parallel.
Stateful Beans
- Stateful session beans can maintain the conversational state with multiple clients at a time and the task is not shared between the clients.
- After the session is completed the state is not retained.
- The container can serialize and store the state as a stale state for future use. This is done to save resources of the application server and to support bean failures.