WebLogic Server 6.1 Code Examples, BEA Systems, Inc.

examples.tutorials.migration.banking
Class Client

java.lang.Object
  |
  +--examples.tutorials.migration.banking.Client

public class Client
extends java.lang.Object

This class demonstrates calling an entity EJBean, followed by two exercises:

Part A: Create an Account and Deposit some money into it. Next attempt to withdraw more than the current account balance. An application-specific exception should be thrown. Finally, remove the account.

Part B: Create some new accounts, with different initial balances. Find all the accounts with a balance greater than a specific value. Find the account with a balance of zero. Attempt to find accounts with a null account type. Finally, remove all newly created accounts.

This class also illustrates how to lookup an EJB home in the JNDI tree.

Author:
Copyright (c) 1998 by WebLogic, Inc. All Rights Reserved., Copyright (c) 1998-2000 by BEA Systems, Inc. All Rights Reserved.

Constructor Summary
Client(java.lang.String url, java.lang.String accountId)
           
 
Method Summary
static void main(java.lang.String[] args)
          Runs this example from the command line.
 void runExamplePartA()
          Executes Part A of this example.
 void runExamplePartB()
          Executes Part B of this example.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Client

public Client(java.lang.String url,
              java.lang.String accountId)
       throws javax.naming.NamingException
Method Detail

main

public static void main(java.lang.String[] args)
Runs this example from the command line. Example:

java examples.ejb.basic.containerManaged.Client "t3://localhost:7001" 10020

The parameters are optional, but if any are supplied, they are interpreted in this order:

Parameters:
url - URL such as "t3://localhost:7001" of Server
accountID - String Account ID to test, default "10020"

runExamplePartA

public void runExamplePartA()
Executes Part A of this example. Part A: Deposit and attempt to withdraw more than the current account balance. An application-specific exception should be thrown.

runExamplePartB

public void runExamplePartB()
                     throws javax.ejb.CreateException,
                            java.rmi.RemoteException,
                            javax.ejb.FinderException,
                            javax.ejb.RemoveException
Executes Part B of this example. Part B: Create 20 new accounts, with different initial balances. Find all the accounts with a balance greater than a specific value. When finished, remove the new accounts.

Documentation is available at
http://e-docs.bea.com/wls/docs61

Copyright © 2001 BEA Systems, Inc. All Rights Reserved.