When to use Session Beans
by, 01-02-2012 at 06:57 PM (2205 Views)
Just one client can access the bean instance at any given time. There exists no persistency in case of state of the bean. They just exist for shorter time duration.
State full session beans are suitable whenever:
- The state of bean presents the interaction b/w a specific client and the bean.
- The bean requires retention of certain information regarding the client, across method invocations.
- There occurs the mediation b/w other application components and client by the beans that shows client a simple view.
- Many enterprise beans workflow is managed by the beans behind the scenes.
Stateless session beans are appropriate when:
- The state of bean doesn’t consist of data for one particular client.
- A generic task is performed for all the clients by the bean in single method invocation. Stateless session bean is used to send out the email which makes the confirmation of an order placed online.
- Set of read only data is being fetch by the bean from a database which is used by the clients. Table rows are retrieved by these beans which present the saleable products for this month.