A container implements the home interface of the enterprise bean installed in the container. The object that implements a session bean's home interface is called a session EJBHome object. The container makes the session beans' home interfaces available to the client through JNDI API. The home interface allows a client to do the following:
EJB.5.3.1 Creating a Session ObjectA home interface defines one or more create(...) methods , one for each way to create a session object. The arguments of the create methods are typically used to initialize the state of the created session object. The following example illustrates a home interface that defines a single create(...) method: public interface CartHome extends javax.ejb.EJBHome { Cart create(String customerName, String account) throws RemoteException, BadAccountException, CreateException; } The following example illustrates how a client creates a new session object using a create(...) method of the CartHome interface: cartHome.create("John", "7506"); EJB.5.3.2 Removing a Session ObjectA client may remove a session object using the remove() method on the javax.ejb.EJBObject interface, or the r emove(Handle handle) method of the javax.ejb.EJBHome interface. Because session objects do not have primary keys that are accessible to clients , invoking the javax.ejb.Home.remove(Object primaryKey) method on a session results in the javax.ejb.RemoveException . |