First page Back Continue Last page Graphics

...Continuation of Notes...


Notes:

Using the EJBObject Instead of this
This example illustrates using the EJBObject reference instead of "this” in a bean instance, to refer to itself.

First, an Order interface that includes a reference to the Customer that owns the order:

public interface Order extends EJBObject {
public Customer getOwner() throws java.rmi.RemoteException;

// Rest of interface...
}


Next, an OrderHome interface with a create( ) that takes a Customer:

public interface OrderHome extends EJBHome {
public Order create(Customer owner)
throws java.rmi.RemoteException;

// Rest of interface...
}

Here is the Customer interface. It has a method to create a new order for that customer.

public interface Customer extends EJBObject {
public Order createOrder() throws java.rmi.RemoteException;

// Rest of interface...
}

Continued...