The SavingsAccountEJB Example

The entity bean illustrated in this section represents a simple bank account. The state of SavingsAccountEJB is stored in the savingsaccount table of a relational database. The savingsaccount table is created by the following SQL statement:

CREATE TABLE savingsaccount 
   (id VARCHAR(3) 
   CONSTRAINT pk_savingsaccount PRIMARY KEY, 
   firstname VARCHAR(24), 
   lastname  VARCHAR(24), 
   balance   NUMERIC(10,2)); 

The SavingsAccountEJB example requires the following code:

  • Entity bean class (SavingsAccountBean)

  • Home interface (SavingsAccountHome)

  • Remote interface (SavingsAccount)

This example also makes use of the following classes:

  • A utility class named InsufficientBalanceException

  • A client class called SavingsAccountClient

The source ...

Get J2EE™ Tutorial, The 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.