Implementing the Stateless Session Bean

This section discusses the implementation of the remote home interface SignOnHome, remote interface SignOn and the stateless session bean class SignOnEJB.

Defining the Home Interface

The home interface, SignOnHome, is defined in Listing 5.1.

Listing 5.1. The Full Text of day05/SignOnHome.java
package day05;

import java.rmi.RemoteException;
import javax.ejb.*;

public interface SignOnHome extends EJBHome {
  SignOn create()
     throws CreateException, RemoteException;
}

So, to create a bean instance, you call the create() method on the home interface, and receive a reference to the remote interface.

Note

For a stateless session bean, the return parameter of create() method of home interface must be remote interface ...

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.