But enough about the home... let’s talk about the EJB object. The component interface. The thing you REALLY want.

Remember, all that InitialContext-JNDI-lookup-cast-narrow-create business was just to get what you really wanted all along—something with the business methods. Something you can use to get the bean to do whatever it is that bean was created for. Number crunching, online shopping, advice.

package headfirst;

import javax.ejb.*;
import java.rmi.RemoteException;


public interface Advice extends EJBObject {

   public String getAdvice() throws RemoteException;

}
image with no caption
image with no caption

Get Head First EJB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.