Sun Java Solaris Communities My SDN Account Join SDN
 
Tutorials & Code Camps

Building a Stateless Session Bean: Step 3

 
Training Index


[ <<Back ] [ Contents ] [ Next>> ]



The home interface for a session bean provides the mechanism by which the container creates 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 provider's tools. There is little-to-no coding to be done by the programmer--it is really just declarative work at this point.

  1. Read the description of the Home Interface below and note the comments in the code fragment.
  2. Save the example source code to the indicated file, and move to the next step.

Here is the source code for the DemoBean EJB:

  /**
   * 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;
   
}

<< Back   Next >>