O'Reilly logo

J2EE™ Tutorial, The by Beth Stearns, Monica Pawlan, Eric Jendrock, Kim Haase, Dale Green, Stephanie Bodoff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required