Java Technology Home Page
A-Z Index

Java Developer Connection(SM)
Online Training

Downloads, APIs, Documentation
Java Developer Connection
Tutorials, Tech Articles, Training
Online Support
Community Discussion
News & Events from Everywhere
Products from Everywhere
How Java Technology is Used Worldwide
 
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;
  
  }

<< BACK NEXT >>


[ This page was updated: 5-Nov-99 ]

Products & APIs | Developer Connection | Docs & Training | Online Support
Community Discussion | Industry News | Solutions Marketplace | Case Studies
Glossary - Applets - Tutorial - Employment - Business & Licensing - Java Store - Java in the Real World
FAQ | Feedback | Map | A-Z Index
For more information on Java technology
and other software from Sun Microsystems, call:
(800) 786-7638
Outside the U.S. and Canada, dial your country's AT&T Direct Access Number first.
Sun Microsystems, Inc.
Copyright © 1995-99 Sun Microsystems, Inc.
All Rights Reserved. Legal Terms. Privacy Policy.