A session bean is a type of EJB (Enterprise JavaBean) that encapsulates the logic of a business process and business rules. There are two types of session beans, as classified on the basis of state mode, namely stateless session bean and stateful session bean.
A state of an object refers to the value in the instance variable.
A stateless session bean does not maintain a conversational state for a particular client, whereas a stateful session bean maintains a conversational state for a particular client.
A stateful session bean is well suited for implementing a business task dedicated to a single client that maintains a conversational state between the bean and the client. For example, a stateful session bean is required to build an online shopping cart in an e-commerce application. The information is maintained during a session. It is based on multiple calls from the client. The information includes: customerid, a list of items, customer buys, etc.
Download free practice test for CIW CIW - Enterprise Specialist exam. Become SUN SCJA certified.If you like this article, please leave a comment or subscribe this blog via RSS or via e-mail, Bookmark and share through your network. Click the AddThis button below. Thanks.
