Javatpoint Logo
Javatpoint Logo

Stateful Session Bean

Stateful Session bean is a business object that represents business logic like stateless session bean. But, it maintains state (data).

In other words, conversational state between multiple method calls is maintained by the container in stateful session bean.

Annotations used in Stateful Session Bean

There are 5 important annotations used in stateful session bean:

  1. @Stateful
  2. @PostConstruct
  3. @PreDestroy
  4. @PrePassivate
  5. @PostActivate

Example of Stateful Session Bean

To develop stateful session bean application, we are going to use Eclipse IDE and glassfish 3 server.

As described in the previous example, you need to create bean component and bean client for creating session bean application.

1) Create stateful bean component

Let's create a remote interface and a bean class for developing stateful bean component.


2) Create stateful bean client

The stateful bean client may be local, remote or webservice client. Here, we are going to create web based client and not using dependency injection.

File: index.jsp
File: operation.jsp
File: operationprocess.jsp
Next TopicJMS Tutorial

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA