We will use a remote stateless session bean for business operations on the Customer entity. We will call our session bean interface BankService
. In later chapters, we will add more entities and business operations that are typically used by a banking application. At this stage our banking application deals with one entity—Customer, and business methods addCustomer()
and findCustomer()
, which respectively add a customer to the database and retrieve a customer entity given the customers identifier. The interface listing follows:
package ejb30.session; import javax.ejb.Remote; import ejb30.entity.Customer; @Remote public interface BankService { void addCustomer(int custId, String firstName, String lastName); Customer findCustomer(int custId); }
The code below shows the session bean implementation, BankServiceBean
:
package ejb30.session; import javax.ejb.Stateless; import javax.persistence.EntityManager; import ejb30.entity.Customer; import javax.persistence.PersistenceContext...