|
WebLogic Server 6.0 Code Examples, BEA Systems, Inc. | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--examples.cluster.ejb.account.AccountBean
AccountBean is an EntityBean. This EJBean illustrates:
Field Summary | |
java.lang.String |
accountId
|
double |
balance
|
(package private) static int |
SLEEP
|
(package private) static boolean |
VERBOSE
|
Constructor Summary | |
AccountBean()
|
Method Summary | |
AccountResult |
balance()
Returns current balance. |
AccountResult |
deposit(double amount)
Adds amount to balance. |
void |
ejbActivate()
This method is required by the EJB Specification, but is not used by this example. |
AccountPK |
ejbCreate(java.lang.String accountId,
double initialBalance)
This method corresponds to the create method in the home interface "AccountHome.java". |
void |
ejbLoad()
This method is required by the EJB Specification, but is not used by this example. |
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)
This method is required by the EJB Specification, but is not used by this example. |
void |
ejbRemove()
This method is required by the EJB Specification, but is not used by this example. |
void |
ejbStore()
This method is required by the EJB Specification, but is not used by this example. |
void |
setEntityContext(javax.ejb.EntityContext ctx)
Sets the EntityContext and the server name for the EJBean. |
void |
unsetEntityContext()
Unsets the EntityContext for the EJBean. |
AccountResult |
withdraw(double amount)
Subtracts amount from balance. |
Methods inherited from class java.lang.Object |
|
Field Detail |
public java.lang.String accountId
public double balance
static final int SLEEP
static final boolean VERBOSE
Constructor Detail |
public AccountBean()
Method Detail |
public AccountResult balance()
public AccountResult deposit(double amount)
amount
- double amountpublic void ejbActivate()
ejbActivate
in interface javax.ejb.EntityBean
public AccountPK ejbCreate(java.lang.String accountId, double initialBalance) throws javax.ejb.CreateException
AccountHome.create()
, the container (which in WebLogic EJB is
also the home) allocates an instance of this EJBean and
calls AccountBean.ejbCreate()
.
For container-managed persistence, ejbCreate()
returns
a void, unlike the case of bean-managed
persistence, where it returns a primary key.
accountId
- string account IDinitialBalance
- double initial balancejavax.ejb.CreateException
- if there is a problem creating the beanpublic void ejbLoad()
ejbLoad
in interface javax.ejb.EntityBean
public void ejbPassivate()
ejbPassivate
in interface javax.ejb.EntityBean
public void ejbPostCreate(java.lang.String accountId, double initialBalance)
accountId
- string account IDinitialBalance
- double initial balancepublic void ejbRemove() throws javax.ejb.RemoveException
ejbRemove
in interface javax.ejb.EntityBean
javax.ejb.RemoveException
- if the EJBean does not allow removing the EJBeanpublic void ejbStore()
ejbStore
in interface javax.ejb.EntityBean
public void setEntityContext(javax.ejb.EntityContext ctx)
setEntityContext
in interface javax.ejb.EntityBean
ctx
- EntityContextpublic void unsetEntityContext()
unsetEntityContext
in interface javax.ejb.EntityBean
public AccountResult withdraw(double amount) throws AccountException
amount
- double amountAccountException
- if amount > balance
|
Documentation is available at http://e-docs.bea.com/wls/docs60 |
|||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |