First page Back Continue Last page Graphics

Continuation of Notes


Notes:

ejbRemove( ) Example
In this example, the CustomerBean checks if this customer has any orders before the customer is deleted. If so, the bean’s ejbRemove( ) method halts the deletion by throwing a RemoveException.

public abstract class CustomerBean implements EntityBean {

public void ejbRemove() throws RemoveException {
boolean bHasOrders = ...; // Ask if Customer has any orders
if(bHasOrders)
throw new RemoveException("Customer # " + getId() +
" has outstanding orders and cannot be removed.");
}

// Rest of class...
} // End of CustomerBean class