Implementing the Stateful Session Bean

This section discusses the implementation of the remote home interface EnrollmentCartHome, the remote interface EnrollmentCart, and the stateful session bean class EnrollmentCartEJB.

Defining the Home Interface

Clients use home interface to create and remove session bean instances. Within the home interface, we define one or more create<method>(...) methods. The container tools generate the class that corresponds to this interface.

Note

A stateful session bean may have more than one create() methods, and some of them may have arguments. This is different, though, from the case of a stateless session bean, which can only have one create() method with no arguments.

Listing 6.1 shows the home interface EnrollmentCartHome ...

Get Sams Teach Yourself EJB in 21 Days now with O’Reilly online learning.

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