Creating a Stateless Session Bean
Now you can move on to actually creating your first EJB. To begin, create a new subdirectory called ejb in your com/bfg source hierarchy. You're going to move the logic that computes sales tax into a bean called Cart. Start by writing the remote interface (see Listing 17.1), which extends EJBObject. There's not much to it really—it just declares the calling parameters for the computeTax call and specifies that it throws RemoteException, as all EJB beans must.
By convention, if a bean implements a functionality called Foo, the remote interface is called Foo, the home interface is called FooHome, and the enterprise bean is called FooBean.
Listing 17.1. Cart.java
package com.bfg.ejb.cart; import javax.ejb.EJBObject; ...