A session bean is the enterprise bean that directly interacts with the user and contains the business logic of the enterprise application. A session bean object is a short-lived object that executes on behalf of a single client. It is created by a client and usually exists only for the duration of a single client-server session. A session bean performs and handles operations, such as calculations or database access, for the client request.
Session beans are divided into two parts: stateless and stateful.
Stateless session beans do not use the class variables (instance variables). So they do not persist data across method invocation and therefore there is no need to passivates the bean's instance.
Stateful beans use the instance variables that allow the data persistent across method invocation because the instance variables allow persistence of data across method invocation.
Liked it! Share this Tutorial