Session Bean

A session is a connection between a client and a server that lasts for a finite period of time. -

Session beans centers on the idea that each request by a client to complete a distinct business process is completed in a session. -

The life cycle of session bean is maintained by the application server (EJB Container).

There are three types of SessionBean Stateless, Statefull & Singleton.

Stateless Session bean :

A stateless session bean does not maintain a conversational state with the client. When a client invokes the methods of a stateless bean, the bean's instance variables may contain a state specific to that client but only for the duration of the invocation.

A stateless session bean can implement a web service.

Stateful Session Bean :

In a stateful session bean, the instance variables represent the state of a unique client/bean session.

Singleton Session Bean :

A singleton session bean is instantiated once per application and exists for the lifecycle of the application.