Entering content frame

Background documentation Stateful or Stateless Session Beans Locate the document in its SAP Library structure

Stateful Session Beans

Stateful session beans have a state that is preserved between subsequent method invocations. This state is called conversational state. For example, this enables a transaction to begin in one business method and to finish in another, or to store information in a bean class’s fields, which can be later used in another business method. The state is preserved as long as the client session lasts. Stateful session beans are associated with and represent a single client.

Use stateful session beans, when:

·        The bean is associated with and contains data about a specific client during method calls

For more information about creating stateful session beans, see Creating Stateful Session Beans.

Stateless Session Beans

Stateless session beans have a simpler logic. It is not possible to preserve information between the invocations of the different business methods. The EJB Container chooses a random bean instance to execute a business method each time a request arrives.

Use stateless session beans, when:

·        The methods of the bean do not depend on the specific client

·        Your application is accessed by many clients

·        You require increased performance

The stateless session bean provides better performance because it requires fewer resources to support a large number of clients. However, you may have to develop more complex clients.

For more information about creating stateless session beans, see Creating Stateless Session Beans.

 

 

Leaving content frame