Home

 

Accessing the session EJB

All database processing is done through the EJBBankBean session bean, using the business interface (EJBBankService).

The servlets use EJB 3.0 injection to access the session bean:

@EJB EJBBankService bank;

After this injection, all the methods of the session bean can be invoked, such as:

Customer customer = bank.getCustomer(customerNumber);
Account{} accounts = bank.getAccounts(customerNumber);
bank.deposit(accountId, amount);
ibm.com/redbooks