|
WebLogic Server 6.0 Code Examples, BEA Systems, Inc. | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--examples.ejb.basic.beanManaged.AccountBean
AccountBean is an EntityBean. This EJBean illustrates:
Constructor Summary | |
AccountBean()
|
Method Summary | |
double |
balance()
Returns current balance. |
double |
deposit(double amount)
Adds amount to balance. |
void |
ejbActivate()
Required by the EJB specification, this method is not used by this example. |
java.lang.String |
ejbCreate(java.lang.String accountId,
double initialBalance)
This method corresponds to the create method in the home interface "AccountHome.java". |
java.util.Enumeration |
ejbFindBigAccounts(double balanceGreaterThan)
Finds all EJBeans with a balance greater than a given amount. |
java.lang.String |
ejbFindByPrimaryKey(java.lang.String pk)
Attempts to find the EJBean with a given Primary Key from the persistent storage. |
void |
ejbLoad()
Loads the EJBean from the persistent storage. |
void |
ejbPassivate()
This method is required by the EJB Specification, but is not used by this example. |
void |
ejbPostCreate(java.lang.String accountId,
double initialBalance)
Required by the EJB specification, this method is not used by this example. |
void |
ejbRemove()
Deletes the EJBean from the persistent storage. |
void |
ejbStore()
Stores the EJBean in the persistent storage. |
void |
setEntityContext(javax.ejb.EntityContext ctx)
Sets the EntityContext for the EJBean. |
void |
unsetEntityContext()
Unsets the EntityContext for the EJBean. |
double |
withdraw(double amount)
Subtracts amount from balance. |
Methods inherited from class java.lang.Object |
|
Constructor Detail |
public AccountBean()
Method Detail |
public double balance()
public double deposit(double amount)
amount
- double Amountpublic void ejbActivate()
ejbActivate
in interface javax.ejb.EntityBean
public java.lang.String ejbCreate(java.lang.String accountId, double initialBalance) throws javax.ejb.CreateException
AccountHome.create()
, the container 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.
accountID
- String Account IDinitialBalance
- double Initial Balancejavax.ejb.CreateException
- if there is a problem creating the beanjavax.ejb.DuplicateKeyException
- if a create is attempted using a Primary Key
already in the databasejavax.ejb.EJBException
- if there is a communications or systems failurepublic java.util.Enumeration ejbFindBigAccounts(double balanceGreaterThan)
balanceGreaterThan
- double Test Amountjavax.ejb.EJBException
- if there is a communications or systems failurepublic java.lang.String ejbFindByPrimaryKey(java.lang.String pk) throws javax.ejb.ObjectNotFoundException
pk
- String Primary Keyjavax.ejb.ObjectNotFoundException
- thrown if the EJBean cannot be foundjavax.ejb.EJBException
- if there is a communications or systems failurepublic void ejbLoad()
ejbLoad
in interface javax.ejb.EntityBean
javax.ejb.NoSuchEntityException
- if the bean is not found in the databasejavax.ejb.EJBException
- if there is a communications or systems failurepublic void ejbPassivate()
ejbPassivate
in interface javax.ejb.EntityBean
public void ejbPostCreate(java.lang.String accountId, double initialBalance)
accountID
- String Account IdentificationinitialBalance
- double Initial Balancepublic void ejbRemove()
ejbRemove
in interface javax.ejb.EntityBean
javax.ejb.NoSuchEntityException
- if the bean is not found in the databasejavax.ejb.EJBException
- if there is a communications or systems failurepublic void ejbStore()
ejbStore
in interface javax.ejb.EntityBean
javax.ejb.NoSuchEntityException
- if the bean is not found in the databasejavax.ejb.EJBException
- if there is a communications or systems failurepublic void setEntityContext(javax.ejb.EntityContext ctx)
setEntityContext
in interface javax.ejb.EntityBean
ctx
- EntityContextpublic void unsetEntityContext()
unsetEntityContext
in interface javax.ejb.EntityBean
public double withdraw(double amount) throws ProcessingErrorException
amount
- double AmountProcessingErrorException
- if Amount > Balance.
|
Documentation is available at http://e-docs.bea.com/wls/docs60 |
|||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |