O'Reilly logo

Head First EJB by Bert Bates, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Remote home interface examples for session beans

The examples on this page are all legal examples of Remote home interfaces. You’ll see some that could be both stateless and stateful, and some that could be only stateful (because they have a create method with arguments). We’ve dropped the package and import statements to put more on the page.

  1. public interface CartHome extends EJBHome {
       public Cart create(String storeID) throws CreateException, RemoteException;
       public Cart create() throws CreateException, RemoteException;
    }
  2. public interface MatcherHome extends EJBHome {
       public Matcher create(String customerID) throws CreateException, RemoteException;
       public Matcher createNewCustomer(String name, String login)
                                         throws CreateException, RemoteException;
    }
  3. public interface TicketsHome extends EJBHome {
       public Tickets create() throws CreateException, RemoteException;
    }
  4. public interface ClubHome extends EJBHome {
       public Club createExisting(String clubID) throws CreateException, RemoteException;
       public Club createNewClub(String clubName) throws CreateException, RemoteException;
    }

There’s only one interface here that could be a stateless session bean’s home—number 3. Notice, too, that number 4 has two create methods that both have the same argument—a String—but the methods are named differently to reflect what that particular create method is for.

image with no caption

What YOU write:

What the CLIENT sees:

Remember, the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required