All Examples  All EJB Examples  This Package

Class examples.ejb.extensions.isModified.AccountBean

java.lang.Object
   |
   +----examples.ejb.extensions.isModified.AccountBean

public class AccountBean
extends Object
implements EntityBean
AccountBean is an EntityBean. This EJBean illustrates:

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

Variable Index

 o accountId
 o balance
 o type

Constructor Index

 o AccountBean()

Method Index

 o balance()
Returns current balance.
 o deposit(double)
Adds amount to balance.
 o ejbActivate()
This method is required by the EJB Specification, but is not used by this example.
 o ejbCreate(String, double, String)
This method corresponds to the create method in the home interface "AccountHome.java".
 o ejbLoad()
Sets the EJBean's modified flag to false.
 o ejbPassivate()
This method is required by the EJB Specification, but is not used by this example.
 o ejbPostCreate(String, double, String)
This method is required by the EJB Specification, but is not used by this example.
 o ejbRemove()
This method is required by the EJB Specification, but is not used by this example.
 o ejbStore()
Sets the EJBean's modified flag to false.
 o id()
Returns the Primary Key identifying this EJBean.
 o isModified()
Returns whether the EJBean has been modified or not.
 o setEntityContext(EntityContext)
Sets the EntityContext for the EJBean.
 o setModified(boolean)
Sets the EJBean's modified flag.
 o type()
Returns account type.
 o unsetEntityContext()
Unsets the EntityContext for the EJBean.
 o withdraw(double)
Subtracts amount from balance.

Variables

 o accountId
 public String accountId
 o balance
 public double balance
 o type
 public String type

Constructors

 o AccountBean
 public AccountBean()

Methods

 o isModified
 public boolean isModified()
Returns whether the EJBean has been modified or not.

Returns:
boolean isDirty
 o setModified
 public void setModified(boolean flag)
Sets the EJBean's modified flag.

Parameters:
flag - Modified Flag
 o id
 public String id()
Returns the Primary Key identifying this EJBean.

Returns:
String Identification
 o ejbActivate
 public void ejbActivate() throws RemoteException
This method is required by the EJB Specification, but is not used by this example.

Throws: RemoteException
if there is a communications or systems failure
 o ejbPassivate
 public void ejbPassivate() throws RemoteException
This method is required by the EJB Specification, but is not used by this example.

Throws: RemoteException
if there is a communications or systems failure
 o 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
 o unsetEntityContext
 public void unsetEntityContext() throws RemoteException
Unsets the EntityContext for the EJBean.

Throws: RemoteException
if there is a communications or systems failure
 o ejbLoad
 public void ejbLoad() throws RemoteException
Sets the EJBean's modified flag to false.

Throws: RemoteException
if there is a communications or systems failure
 o ejbStore
 public void ejbStore() throws RemoteException
Sets the EJBean's modified flag to false.

Throws: RemoteException
if there is a communications or systems failure
 o ejbRemove
 public void ejbRemove() throws RemoteException
This method is required by the EJB Specification, but is not used by this example.

Throws: RemoteException
if there is a communications or systems failure
 o ejbCreate
 public void ejbCreate(String accountId,
                       double initialBalance,
                       String type)
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 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.

Parameters:
accountID - String Account ID
initialBalance - double Initial Balance
type - String Account type
 o ejbPostCreate
 public void ejbPostCreate(String accountId,
                           double initialBalance,
                           String type)
This method is required by the EJB Specification, but is not used by this example.

Parameters:
accountID - String Account Identification
initialBalance - double Initial Balance
type - String Account type
 o deposit
 public double deposit(double amount)
Adds amount to balance.

Parameters:
amount - double Amount
Returns:
double balance
 o withdraw
 public double withdraw(double amount) throws ProcessingErrorException
Subtracts amount from balance.

Parameters:
amount - double Amount
Returns:
double Balance
Throws: ProcessingErrorException
if Amount > Balance
 o balance
 public double balance()
Returns current balance.

Returns:
double Balance
 o type
 public String type()
Returns account type.

Returns:
String Type

All Examples  All EJB Examples  This Package