All Examples All Cluster Examples This Example This Package
Class examples.cluster.ejb.teller.TellerBean
java.lang.Object
|
+----examples.cluster.ejb.teller.TellerBean
- public class TellerBean
- extends Object
- implements SessionBean
TellerBean is a stateless SessionBean. This bean illustrates:
- No persistence of state between calls to the SessionBean
- Accessing properties in a deployment descriptor
- Finding entity beans
- Using bean-managed transactions with entity beans
- Connecting to a database from within a session bean
- Application-defined exceptions
- Author:
- Copyright (c) 1999 by BEA WebXpress, Inc. All Rights Reserved.
-
TellerBean()
-
-
balance(String)
- Returns the balance of the account in a TellerResult object.
-
checkTransactionId(String)
- Returns true if the transaction with a given
id was completed (ie, the transaction ID can be found
in the transaction log table).
-
deposit(String, double, String)
- Deposits amount in specified account using a specific transactionID.
-
ejbActivate()
- This method is required by the EJB Specification,
but is not used by this example.
-
ejbCreate()
- This method corresponds to the create method in the home interface
"TellerHome.java".
-
ejbPassivate()
- This method is required by the EJB Specification,
but is not used by this example.
-
ejbRemove()
- This method is required by the EJB Specification,
but is not used by this example.
-
setSessionContext(SessionContext)
- Sets the session context, server name, properties,
maximum log table size and the log pool name.
-
transfer(String, String, double, String)
- Transfers amount from accountFrom to accountTo using a specific transactionID.
-
withdraw(String, double, String)
- Withdraws amount from specified account using a specific transactionID.
TellerBean
public TellerBean()
ejbActivate
public void ejbActivate() throws RemoteException
- This method is required by the EJB Specification,
but is not used by this example.
ejbRemove
public void ejbRemove() throws RemoteException
- This method is required by the EJB Specification,
but is not used by this example.
ejbPassivate
public void ejbPassivate() throws RemoteException
- This method is required by the EJB Specification,
but is not used by this example.
setSessionContext
public void setSessionContext(SessionContext ctx)
- Sets the session context, server name, properties,
maximum log table size and the log pool name.
- Parameters:
- ctx - SessionContext
ejbCreate
public void ejbCreate()
- This method corresponds to the create method in the home interface
"TellerHome.java".
The parameter sets of the two methods are identical. When the client calls
TellerHome.create()
, the container allocates an instance of
the EJBean and calls ejbCreate()
.
- See Also:
- Teller
balance
public TellerResult balance(String accountId) throws TellerException, RemoteException
- Returns the balance of the account in a TellerResult object.
- Parameters:
- accountId - String Account ID
- Returns:
- TellerResult Result of inquiry
- Throws: TellerException
- if there is an error while checking the balance
- Throws: RemoteException
- if there is
a communications or systems failure
deposit
public TellerResult deposit(String accountId,
double amount,
String transactionId) throws TellerException, RemoteException
- Deposits amount in specified account using a specific transactionID.
- Parameters:
- accountId - String Account ID
- amount - double Amount to deposit
- transactionId - String Transaction ID
- Returns:
- TellerResult Result of inquiry
- Throws: TellerException
- if there is an error while making the deposit
- Throws: RemoteException
- if there is
a communications or systems failure
withdraw
public TellerResult withdraw(String accountId,
double amount,
String transactionId) throws TellerException, RemoteException
- Withdraws amount from specified account using a specific transactionID.
- Parameters:
- accountId - String Account ID
- amount - double Amount to withdraw
- transactionId - String Transaction ID
- Returns:
- TellerResult Result of inquiry
- Throws: TellerException
- if there is an error while making the withdrawal
- Throws: RemoteException
- if there is
a communications or systems failure
transfer
public TellerResult transfer(String accountFrom,
String accountTo,
double amount,
String transactionId) throws TellerException, RemoteException
- Transfers amount from accountFrom to accountTo using a specific transactionID.
- Parameters:
- accountFrom - String Account ID of account taking amount from
- accountTo - String Account ID of account sending amount to
- amount - double Amount to transfer
- transactionId - String Transaction ID
- Returns:
- TellerResult Result of inquiry
- Throws: TellerException
- if there is an error while making the transfer
- Throws: RemoteException
- if there is
a communications or systems failure
checkTransactionId
public boolean checkTransactionId(String transactionId) throws RemoteException
- Returns true if the transaction with a given
id was completed (ie, the transaction ID can be found
in the transaction log table).
Note that the code in this method is specific for Oracle
databases and would require adjustment for other databases.
- Parameters:
- transactionID - String Transaction ID
- Returns:
- boolean
- Throws: RemoteException
- if there is
a communications or systems failure
All Examples All Cluster Examples This Example This Package