Technical Support
Discussion Forum
Online Training
Technical Articles
Bug Parade
JDC Resources
DukeDollars
Early Access
Toolbar
Community Process
Technology Sites

JDC Home Page

Solaris Developer Connection

Java Technology
java.sun.com

Java Industry Connection

Log Out

Online Training
SearchFAQContact Us

Online Training Index

Step 2: Specifying the Enterprise JavaBeansTM Remote Interface

In this step you will create the Enterprise JavaBeans remote interface.
  • Read the explanation below.
  • Save the code example to a file as indicated.

The remote interface is the client's view of the Enterprise JavaBeans, and the task of the Enterprise JavaBeans developer is to declare this interface using JavaTM RMI syntax. It is the responsibility of the Enterprise JavaBeans' container tools provider to generate the code of this interface.

Note: There are limitations on what can be specified in this interface. For a full list, see the Enterprise JavaBeans Specification, Section 16. It is important that, all objects used, the parameters, return values, and exceptions are valid types in the "Java to IDL Mapping Specification."

For the simple DemoBean here is the remote interface source. Save this to a file named Demo.java.

 /**
  * Demo -- this is the "remote" interface of
  * our enterprise JavaBean, it
  * defines only one simple method called
  * demoSelect(). As this is meant to be
  * the simplest of examples demoSelect()
  * never goes to a database, it just
  * returns a string
  *
  * 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
  * 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;
  
  }

previous next





Questions?
22-Apr-99
Copyright © 1996-1999 Sun Microsystems Inc.
All Rights Reserved. Legal Terms. Privacy Policy.
Sun Microsystems