Thursday, 3 September 2015

Java Source World: What is Session Bean. What are the various types of Session Bean

Session Bean in EJB | Java Source World

           

                                                                                       Java Source World                A Java quick reference blog


What is Session Bean. What are the various types of Session Bean


SessionBeans



They are usually associated with one client. Each session bean is created
and destroyed by the particular EJB client that is associated with it. These beans do not
survive after system shutdown.

These Session Beans are of two types:

Stateful Session Beans:



They maintain conversational state between subsequest calls by a client
  • Stateful Session Beans : These beans have internal states. They can be stored (getHandle()) and restored (getEJBObject()) across client sessions.Since they can be persistence, they are also called as Persistence Session Beans.
  • Stateless Session Beans : These beans do not have internal States. They need not bepassivated. They can be pooled into service multiple clients.

More about:



Stateless Session Bean:

Consider this as a servlet equivalent in EJB. It is just used to service clients regardless of state and does not maintain any state.



Stateful:


Stateful sessionBeans have the passivated and Active state which the Stateless bean does not have.

Stateful beans are also Persistent session beans. They are designed to service business processes that span multiple method requests or transactions.

Stateful session beans remembers the previous requests and reponses.

Stateful session beans does not have pooling concept.

Stateful Session Beans can retain their state on behave of an individual client.

Stateful Session Beans can be passivated and reuses them for many clients.

Stateful Session Bean has higher performance over stateless sessiob bean as they are pooled by the application server.

Stateless:


Stateless Session Beans are designed to service business process that last only for a single method call or request.

Stateless session beans do not remember the previous request and responses.

Stattless session bean instances are pooled.

Stateless Session Beans donot maintain states.

Stateless Session Beans, client specific data has to be pushed to the bean for each method invocation which result in increase of network traffic.


Also Read: Difference between Stateful session bean and Stateless session bean




                         

                                                                                       Java Source World                A Java quick reference blog







No comments:

Post a Comment