Sun Java System Application Server 

Samples Index

The SimpleBank BMP Robean Sample Application

The SimpleBank BMP Robean sample application demonstrates how to use Read Only Beans (ROBs). ROBs are entity beans that are never modified by an Enterprise JavaBean (EJB) client. They can be declared by specifying the is-read-only-bean element in the sun-ejb-jar.xml. The data that an ROB represents may be updated by external means. To eliminate the cost of using ejbStore, use ROBs when the data they represent is stable or rarely changes.

ROB restrictions include the following:

An application can refresh the state of ROBs:

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/bmp/apps/robean.
  2. Deploy the Application The EAR file is install_dir/samples/ejb/bmp/apps/robean/bmp-robean.ear.
  3. Run the Application The context root is SimpleBank.

Resrouce Configuration

This application requires configuration of JDBC resources. If you deploy it using asant, then the script will register the resources automatically. But if you use another deployment mechanism, you must perform it manually as follows:

  1. Start the database server if you have not already done so.
  2. Configure the JDBC connection pool:
    asadmin create-jdbc-connection-pool --host admin-host --port admin-port
      --user user --password password
      --datasourceclassname datasource-classname
      --property User=bmp:Password=bmp:url-property="JDBC URL"
      bmp-robean-pool
      
    For Derby, use DatabaseName as the value for url-property. You must escape colons (:) and slashes (/) in JDBC URL. An example of JDBC URL is jdbc\:derby\:\/\/localhost\:1527\/DerbyDB;create=true.
  3. Configure the JDBC resource:
    asadmin create-jdbc-resource --host admin host --port admin port
    --user user --password password
    --connectionpoolid  "cmpcustomer-pool jdbc/cmpcustomer"
    

Using the Application

  1. In the SimpleBank application, enter 123456789 as Customer Social Security Number.
  2. Click Enter.
  3. Enter amount in $ text box and click Update to update the current balance.
  4. Click on Get Trans. Balance. to update Transactional Refresh.
  5. Click on Get Prog. Balance. to update Programmatic Refresh.
  6. Wait for thirty seconds.
    The page will be refreshed and Time-based Refresh will be updated.

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