|
WebLogic Server 6.0 Code Examples, BEA Systems, Inc. |
See:
Description
Interface Summary | |
Stock | The remote interface for the StockBean read-only EJB. |
StockHome | The home interface for the StockBean read-only EJB. |
StockWriter | The remote interface for the StockWriterBean. |
StockWriterHome | The home interface for the StockWriterBean. |
Class Summary | |
Client | This class illustrates how to use a read-only EJB and a read-write EJB together to provide "read-mostly" access to a set of data. |
StockBean | StockBean is a read-only EntityBean. |
StockWriterBean | StockWriterBean is an EntityBean. |
This example includes a read-only entity EJB called Stock and a read-write entity EJB named StockWriter. Both EJBs work together to provide "read-mostly" access to a set of data. See BEA WebLogic Server Enterprise Java Beans for more information about the read-only and read-write strategies for entity EJBs.
To get the most out of this example, first read through the source code files.
After you are familiar with the classes and deployment files, follow the instructions given to build and run the examples:
This example ships "pre-built"; you can either run it as shipped, or rebuild the example and run it to test that you are able to successfully build and run EJBeans.
We provide separate build scripts for Windows NT and UNIX:
These scripts will build the example and place the files in the correct locations in your WebLogic Server distribution:
Running the build script places the EJB in /config/examples/applications, where it automatically deploys once the server is started. Also, if you are already running the server and build another EJB, it is automatically placed in this directory and instantly deployed.
Additional information on using the build scripts is found in Building Enterprise JavaBean examples
For your convenience, a sample connection pool, called demoPool is included with this example. You can use this connection pool with any of the EJB examples.
# In the left-hand pane, expand the Services node and choose JDBC.
# Click demoPool to display the configuration information in the right-hand pane.
# Click the Connections tab and review the attribute settings to make sure that they are correct.
In particular, make sure that the URL and Driver Classname attributes are set for the correct database. This example connection pool is pre-configured for Cloudscape. For other databases, you will need to set an appropriate url and driver, such as
URL=jdbc:weblogic:oracle,\ DriverName=weblogic.jdbc.oci.Driver,\
In this example, the fileRealm for the access control list (ACL) is pre-configured to allow access for everyone.
If you need more information about how to use connection pools, read Programming WebLogic JDBC.
Set up your client as described in Setting up your environment, and then run it by entering:
$ java examples.ejb.extensions.readMostly.Client "t3://WebLogicURL:Port"
where:
Beginning readMostly.Client... Creating a StockWriter for BEAS Looking up Stock info for BEAS BEAS: Price: 100.0 Volume: 1000 52 Week High: 100.0 52 Week Low: 100.0 Removing the StockWriter Ending readMostly.Client...
|
Documentation is available at http://e-docs.bea.com/wls/docs60 |