Step #3:  Specify the Home Interface

The home interface for a session bean provides the mechanism by which the container can create new session beans on behalf of the client. The home interface, just like the remote interface, is declared by the bean developer in RMI syntax, and again, is implemented by the container providers' tools. There is little-to-no coding work to be done by the programmer; at this point it is really just declarative work.

For our DemoBean EJB the home interface looks like this (source):



/** 
 * DemoHome.java - This is the Home interface it must
 * extend javax.ejb.EJBHome and define one or more
 * create() methods for the bean.
 * 
 * Note: The implementation of this interface is
 *       generated by the container tools.
 */ 

package ejb.demo; 

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

/** 
 * This interface is extremely simple it declares only
 * one create method. 
 */ 
public interface DemoHome extends EJBHome { 

 
  public Demo create()  throws CreateException, RemoteException; 
 



 


previous next