Step #2 :   Specify The Enterprise Java Bean Remote Interface  

The remote interface is the clients view of the EJB the task of the EJB developer  is to declare this interface  in normal Java RMI syntax it it the responsibility of the Enterprise Java Bean container tools provider to generate the implementation of this interface. 
There are limitations on what can be specified in this interface, please refer to the EJB specification (sectoin #16 ) but importantly all of the objects used and parameters, return values and exceptions must be valid types in the "java to IDL mapping specification" 

for our simple DemoBean  the remote interface looks like 



/** 
 * Demo -- this is the "remote" interface of our Enterprise Java Bean, it  
 *         defines only one simple method called demoSelect() which as this is  
 *         a stateless minimal bean example it just returns a string, no  
 *         database lookup is attempted. 
 * 
 *  Note: The implementation of this interface is provided by the container tools 
 *        but the demoSelect() method and any other methods in this interface 
 *        will need to have equivalent implementations in the DemoBean.java 
 *        implementation which is supplied by the bean Writer ..i.e. you! 
 */ 

package ejb.demo; 

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

public interface Demo extends EJBObject, Remote { 

  // NB this simple example does not even do a lookup in the database 
  public String demoSelect() throws RemoteException; 




 
 
 
 
Questions?  
July 1998 
Copyright © 1996,1997,1998 Sun Microsystems Inc. 
All Rights Reserved. 
Sun Logo
Questions? 
27-Mar-97 
Copyright © 1996,1997 Sun Microsystems Inc. 
All Rights Reserved. Sun Logo