All Examples All EJB Examples This Package
Class examples.ejb.extensions.isModifiedBeanManaged.AccountBean
java.lang.Object
|
+----examples.ejb.extensions.isModifiedBeanManaged.AccountBean
- public class AccountBean
- extends Object
- implements EntityBean
AccountBean is an EntityBean. This EJBean illustrates:
- EJBean-managed persistence and transactions;
the code in this file directly accesses the data storage.
- Application-defined exceptions.
- Author:
- Copyright (c) 1998 by WebLogic, Inc. All Rights Reserved., Copyright (c) 1998-1999 by BEA WebXpress. All Rights Reserved.
-
accountId
-
-
balance
-
-
AccountBean()
-
-
balance()
- Returns current balance.
-
deposit(double)
- Adds amount to balance.
-
ejbActivate()
- Forces reload of EJBean by setting modified flag true.
-
ejbCreate(String, double)
- This method corresponds to the create method in the home interface
"AccountHome.java".
-
ejbFindBigAccounts(double)
- Finds all EJBeans with a balance greater than a given amount.
-
ejbFindByPrimaryKey(AccountPK)
- Given a Primary Key, refreshes the EJBean from
the persistent storage.
-
ejbLoad()
- Refreshes the EJBean from the persistent storage.
-
ejbPassivate()
- Sets the dirty flag when the EJBean is passivated.
-
ejbPostCreate(String, double)
- Sets the EJBean's modified flag to false.
-
ejbRemove()
- Deletes the EJBean from the persistent storage.
-
ejbStore()
- Stores the EJBean in the persistent storage
if it has been modified.
-
getConnection()
- Gets current connection to the connection pool.
-
id()
- Returns the Primary Key identifying this EJBean.
-
isModified()
- Returns whether the EJBean has been modified or not.
-
setEntityContext(EntityContext)
- Sets the EntityContext for the EJBean.
-
setModified(boolean)
- Sets the EJBean as modified.
-
unsetEntityContext()
- Unsets the EntityContext for the EJBean.
-
withdraw(double)
- Subtracts amount from balance.
accountId
public String accountId
balance
public double balance
AccountBean
public AccountBean()
isModified
public boolean isModified()
- Returns whether the EJBean has been modified or not.
- Returns:
- boolean isDirty
setModified
public void setModified(boolean flag)
- Sets the EJBean as modified.
- Parameters:
- flag - boolean Flag
id
public String id()
- Returns the Primary Key identifying this EJBean.
- Returns:
- String Identification
ejbActivate
public void ejbActivate() throws RemoteException
- Forces reload of EJBean by setting modified flag true.
- Throws: RemoteException
- if there is a communications or systems failure
setEntityContext
public void setEntityContext(EntityContext ctx) throws RemoteException
- Sets the EntityContext for the EJBean.
- Parameters:
- ctx - EntityContext
- Throws: RemoteException
- if there is a communications or systems failure
unsetEntityContext
public void unsetEntityContext() throws RemoteException
- Unsets the EntityContext for the EJBean.
- Throws: RemoteException
- if there is a communications or systems failure
ejbPassivate
public void ejbPassivate() throws RemoteException
- Sets the dirty flag when the EJBean is passivated.
- Throws: RemoteException
- if there is a communications or systems failure
ejbLoad
public void ejbLoad() throws RemoteException
- Refreshes the EJBean from the persistent storage.
- Throws: RemoteException
- if there is a communications or systems failure
ejbFindByPrimaryKey
public AccountPK ejbFindByPrimaryKey(AccountPK pk) throws FinderException, RemoteException
- Given a Primary Key, refreshes the EJBean from
the persistent storage.
- Parameters:
- pk - AccountPK Primary Key
- Returns:
- AccountPK Primary Key
- Throws: RemoteException
- if there is a communications or systems failure
- Throws: FinderException
- thrown if the EJBean cannot be found
ejbStore
public void ejbStore() throws RemoteException
- Stores the EJBean in the persistent storage
if it has been modified.
- Throws: RemoteException
- if there is a communications or systems failure
ejbRemove
public void ejbRemove() throws RemoteException
- Deletes the EJBean from the persistent storage.
- Throws: RemoteException
- if there is a communications or systems failure
ejbCreate
public AccountPK ejbCreate(String accountId,
double initialBalance) throws CreateException
- This method corresponds to the create method in the home interface
"AccountHome.java".
The parameter sets of the two methods are identical. When the client calls
AccountHome.create(), the container (which in WebLogic EJB is
also the home) allocates an instance of this bean and
calls AccountBean.ejbCreate().
For bean-managed persistence, ejbCreate() returns
a primary key, unlike the case of container-managed
persistence, where it returns a void.
- Parameters:
- accountID - String Account ID
- initialBalance - Double Initial Balance
- Returns:
- AccountPK
- Throws: CreateException
- if there is a problem creating the bean
ejbPostCreate
public void ejbPostCreate(String accountId,
double initialBalance)
- Sets the EJBean's modified flag to false.
- Parameters:
- accountID - String Account Identification
- initialBalance - double Initial Balance
ejbFindBigAccounts
public Enumeration ejbFindBigAccounts(double balanceGreaterThan) throws FinderException, RemoteException
- Finds all EJBeans with a balance greater than a given amount.
Returns an Enumeration of found EJBean primary keys.
- Parameters:
- balanceGreaterThan - double Test Amount
- Returns:
- Enumeration EJBean Primary Keys
- Throws: RemoteException
- if there is a communications or systems failure
- Throws: FinderException
- if an error occurs while accessing
the persistent storage
deposit
public double deposit(double amount) throws ProcessingErrorException
- Adds amount to balance.
- Parameters:
- amount - double Amount
- Returns:
- double balance
- Throws: ProcessingErrorException
- if there is an error making a deposit
withdraw
public double withdraw(double amount) throws ProcessingErrorException
- Subtracts amount from balance.
- Parameters:
- amount - double Amount
- Returns:
- double Balance
- Throws: ProcessingErrorException
- if Amount > Balance.
balance
public double balance()
- Returns current balance.
- Returns:
- double Balance
getConnection
public Connection getConnection() throws SQLException
- Gets current connection to the connection pool.
- Returns:
- Connection
- Throws: SQLException
- if there is an error getting a Connection
All Examples All EJB Examples This Package