| Sun Java System Application Server |
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:
ejbStore on ROBs. ejbLoads will be called only when a bean is created
or when a transactional method is called or at refresh intervals. ejbCreate and ejbRemove
methods. An application can refresh the state of ROBs:
refresh-period-in-second property
in sun-ejb-jar.xml
- If the period specified is negative, the state of ROB will never be refreshed.
If the period specified is 0 (zero), the state of ROB will always be refreshed.
If the period specified is greater than zero, the state of ROB will be refreshed
periodically at that rate. In the sample, CustomerRefreshEJB has a refresh
period of 60 seconds, so the state of CustomerRefreshEJB is refreshed every
minute.
ReadOnlyBeanNotifier.
For example, this code updates the state of CustomerProgRefreshEJB:
ReadOnlyBeanNotifier notifier =
ReadOnlyBeanHelper.getReadOnlyBeanNotifier("java:comp/env/ejb/customerProgRefresh");
notifier.refresh(new PKString1(SSN));
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:
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:
install_dir is the directory where Application Server is installed.
app_dir is the application base directory: install_dir/samples/ejb/bmp/apps/robean.
bmp-robean.ear.
Follow this general procedure:
build.xml, is in the app_dir
directory, specifically, install_dir/samples/ejb/bmp/apps/robean.
install_dir/samples/ejb/bmp/apps/robean/bmp-robean.ear.
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:
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-poolFor 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.
asadmin create-jdbc-resource --host admin host --port admin port --user user --password password --connectionpoolid "cmpcustomer-pool jdbc/cmpcustomer"
Copyright © 2006 Sun Microsystems, Inc. All rights reserved.