The SavingsAccountBean Example

The entity bean illustrated in this section represents a simple bank account. The state of SavingsAccountBean 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 SavingsAccountBean example requires the following code:

  • Entity bean class (SavingsAccountBean)

  • Home interface (SavingsAccountHome)

  • Remote interface (SavingsAccount)

This example also uses the following classes:

  • A utility class named InsufficientBalanceException

  • A client class called SavingsAccountClient

The source code for ...

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