Setting Up the Database
The instructions that follow explain how to use the
SavingsAccountEJB example with a Cloudscape database. The Cloudscape software is included with the J2EE SDK download bundle.- From the command-line prompt, run the Cloudscape database server by typing
cloudscape -start.(When you are ready to shut down the server, typecloudscape -stop.) - Create the
savingsaccountdatabase table.
You may also run this example with databases other than Cloudscape. (See the Release Notes of the J2EE SDK for a list of supported databases.) If you are using one of these other databases, you may run the
j2eetutorial/examples/sql/savingsaccount.sql script to create the savingsaccount table.Deploying the Application
- In
deploytool, open thej2eetutorial/examples/ears/SavingsAccountApp.earfile (File
Open). - Deploy the
SavingsAccountAppapplication (Tools
Deploy). In the Introduction dialog box, make sure that you select the Return Client JAR checkbox.
Running the Client
- In a terminal window, go to the
j2eetutorial/examples/earsdirectory. - Set the
APPCPATHenvironment variable toSavingsAccountAppClient.jar. - Type the following command on a single line:
runclient -client SavingsAccountApp.ear -name SavingsAccountClient -textauth - At the login prompts, enter
guestfor the user name andguest123for the password. - The client should display the following lines:
balance = 68.25 balance = 32.55 456: 44.77 730: 19.54 268: 100.07 836: 32.55 456: 44.77 4.00 7.00
* @ejb:ejb-name bank/Account
* @ejb:jndi-name ejb/bank/Account
* @ejb:finder Collection findAll()
* @ejb:finder Collection findByOwner(Customer owner)
* @ejb:finder Collection findLargeAccounts(int balance)
* @ejb:env-entry foo 1234 java.lang.Integer
* @ejb:ejb-ref bank/Customer
* @ejb:security-role-ref admin Administrator
* @ejb:permission Teller
* @ejb:transaction Required
* @ejb:use-soft-locking
*
* JBoss specific
* @jboss:container-configuration Standard CMP EntityBean
*
* JBoss/JAWS CMP specific
* @jboss:table-name account
* @jboss:create-table true
* @jboss:remove-table true
* @jboss:tuned-updates true
* @jboss:read-only false
* @jboss:finder-query findLargeAccounts $1 > 1000
* @jboss:finder-order findLargeAccounts balance
*/
public abstract class AccountBean
{