Sun Java System Application Server 

Samples Index

The SimpleBank EJB Subclassing Sample Application

The SimpleBank EJB Subclassing application demonstrates subclassing beans as a way to simplify related bean classes. This example has a parent bean that contains methods that are unique or can be overridden by the methods in the child bean. Notice that there are no properties defined for the parent bean in the sun-ejb-jar.xml deployment descriptor: only the children have the properties defined. A relational database is required to run this application.

Setting Up the Environment

Before you deploy or run the application, you must ensure that a database resource has been configured for Application Server. The included asant deployment script automatically performs this step for you. But if you are using another deployment mechanism, you must perform it manually.

You can use any JDBC-compliant relational database server, but specific instructions are provided for the following:

Building, Deploying, and Running the Application

The general instructions for building, deploying, and running sample applications are provided in Building, Deploying, and Running Sample Applications. In reading this document, use the following application-specific variables for this application:

Follow this general procedure:

  1. Build the Application. The build file, build.xml, is in the app_dir directory, specifically, install_dir/samples/ejb/misc/apps/subclassing.
  2. Deploy the Application. The EAR file is install_dir/samples/ejb/misc/apps/subclassing/subclassing.ear.
  3. Run the Application. Follow the instructions in the next section. The application name is subclassing.

Running the Sample Application

To run the sample application, complete the following steps.

  1. Enter this URL in your browser http://hostname:port/subclassing/index.html.
  2. Type 123456789 in the Customer Social Security Number field. Click Edit.
  3. Enter data, filling in the amounts. Click Update Customer to update the required fields.
  4. Return to the main page. Enter the Social Security Number of a new customer. Click Create.
  5. Edit the amounts. Click Update Customer to update the required fields.
  6. Return to the main page. Enter the previous Social Security Number. Click Delete to remove the customer records.

You can verify the results by opening a SQL connection in a new window and running queries against the customer2 table.

Troubleshooting

Before redeploying the application again, please delete the jdbc resources with this command: asant unsetup.

KNOWN ISSUE: While running the sample, entering decimal amounts against Savings Account and Checking Account may result in 500 internal error.


Copyright © 2006 Sun Microsystems, Inc. All rights reserved.