Stateful Session Beans

Now that you have learned how to specify and implement stateless Session beans, it is time to look at stateful Session beans. As you shall see, there are many similarities, but the lifecycle is different and warrants close attention.

Specifying a Stateful Session Bean

Specifying a stateful Session bean is similar to specifying a stateless Session bean. The remote interface defines access to the bean by remote clients, and every method of the remote interface must throw a RemoteException. The primary difference (from a specification viewpoint) is that there can be multiple create() methods in the home interface of a stateful Session bean.

You will recall that a stateless Session bean allows for only a single no argument ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with O’Reilly online learning.

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