Stateful Session EJBs

At first glance, stateful session beans seem very similar to stateless session beans. In theory, there are no required code changes to convert a stateless session bean to become stateful. Both EJB types must implement the javax.ejb.SessionBean interface and have the same basic requirements on the home and remote interface. However, in practice, stateful session beans look quite different from their stateless counterparts. Most of this differentiation is due to their stateful programming model.

The Stateful Programming Model

In the stateful session bean programming model, a client calls a create method on the home interface to create a new instance. Unlike stateless session beans, this causes the container to allocate a new ...

Get J2EE™ Applications and BEA™ WebLogic Server™ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.