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 ...

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.