Oracle8i Enterprise JavaBeans Developer's Guide and Reference Release 3 (8.1.7) Part Number A83725-01 |
Library | Service | Contents | Index

## Invoking Enterprise JavaBeans

An Enterprise JavaBean has two client interfaces: a remote interface and a home interface. The remote interface specifies the methods that the object's clients can invoke; the home interface defines how clients can create the object, which returns a reference to the object. The client uses both of these interfaces when invoking a method on a bean.

The events that occur when a client invokes a method within a bean are explained in the following diagram and steps:

#### Figure 2-1 Sequence of events in a session bean lifecycle

The numbers in the figure correspond to the following numbered steps:

1. Client 1 looks up home interface of bean X.

   During the JNDI lookup, the database creates a session for the server-side of the request.

2. Reference to home interface X is returned to client 1.

3. Client 1 invokes `create` on home interface X.

   The bean instance is created within the session that was established on the JNDI lookup.

4. Home interface X instantiates remote interface X. The container instantiates the bean for this client and is destroyed only when the client invokes the remove.

   The object reference of remote interface X is returned to client 1.

5. Client 1 uses remote interface X to invoke methods on bean instance X.

6. Remote interface X delegates call to a bean.

7. Client 1 invokes `remove` on remote interface X when it is done with the bean instance. This destroys the remote interface and the bean instance.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index