Session Beans

 


Overview

To access apps deployed on a server, a client will invoke the methods of a session bean.

A session bean is like an interactive session in that it is not not shared with other clients, and is not persistent. When the client terminates, the associated session bean also terminates.

 

Stateful Session Beans

In a stateful session bean, instance variables represent the state of a unique client-bean session, and are sustained throughout the duration of the client-bean session. If the client removes the bean or terminates, the session ends and the state disappears.

 

Stateless Session Beans

Do not maintain instance variables throughout a session. When a method is invoked, the bean's instance variables may contain a state, but only for the duration of the invocation. When the method is finished, the state is no longer retained.

Can support multiple clients, they can offer better scalability for apps that require large numbers of clients.