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 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.