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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.