samples.j2ee.ejb.sequence.oracle
Class OracleBean

java.lang.Object
  |
  +--samples.j2ee.ejb.sequence.oracle.OracleBean

public class OracleBean
extends java.lang.Object
implements javax.ejb.EntityBean

OracleBean is an EntityBean. This EJBean illustrates:

See Also:
Serialized Form

Field Summary
 int accountId
           
static int lastKey
           
static int maxKey
           
 double salary
           
 
Constructor Summary
OracleBean()
           
 
Method Summary
 java.lang.Integer accountId()
          Returns account ID.
 void ejbActivate()
          This method is required by the EJB Specification, but is not used by this example.
 void ejbCreate(double initialSalary)
          This method corresponds to the create method in the home interface "OracleHome.java".
 void ejbCreate(java.lang.Integer accountId, double initialSalary)
          This method corresponds to the create method in the home interface "OracleHome.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(double initialSalary)
          This method is required by the EJB Specification, but is not used by this example.
 void ejbPostCreate(java.lang.Integer accountId, double initialSalary)
          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.
 double salary()
          Returns current salary.
 void setEntityContext(javax.ejb.EntityContext ctx)
          Sets the EntityContext for the EJBean.
 void unsetEntityContext()
          Unsets the EntityContext for the EJBean.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

accountId

public int accountId

salary

public double salary

lastKey

public static int lastKey

maxKey

public static int maxKey
Constructor Detail

OracleBean

public OracleBean()
Method Detail

ejbActivate

public void ejbActivate()
This method is required by the EJB Specification, but is not used by this example.
Specified by:
ejbActivate in interface javax.ejb.EntityBean

ejbPassivate

public void ejbPassivate()
This method is required by the EJB Specification, but is not used by this example.
Specified by:
ejbPassivate in interface javax.ejb.EntityBean

setEntityContext

public void setEntityContext(javax.ejb.EntityContext ctx)
Sets the EntityContext for the EJBean.
Specified by:
setEntityContext in interface javax.ejb.EntityBean
Parameters:
ctx - EntityContext

unsetEntityContext

public void unsetEntityContext()
                        throws java.rmi.RemoteException
Unsets the EntityContext for the EJBean.
Specified by:
unsetEntityContext in interface javax.ejb.EntityBean

ejbLoad

public void ejbLoad()
This method is required by the EJB Specification, but is not used by this example.
Specified by:
ejbLoad in interface javax.ejb.EntityBean

ejbStore

public void ejbStore()
This method is required by the EJB Specification, but is not used by this example.
Specified by:
ejbStore in interface javax.ejb.EntityBean

ejbRemove

public void ejbRemove()
               throws javax.ejb.RemoveException
This method is required by the EJB Specification, but is not used by this example.
Specified by:
ejbRemove in interface javax.ejb.EntityBean
Throws:
javax.ejb.RemoveException - if the EJBean does not allow removing the EJBean

ejbCreate

public void ejbCreate(java.lang.Integer accountId,
                      double initialSalary)
               throws javax.ejb.CreateException
This method corresponds to the create method in the home interface "OracleHome.java". The parameter sets of the two methods are identical. When the client calls OracleHome.create(), the container (which in WebLogic EJB is also the home) allocates an instance of this EJBean and calls OracleBean.ejbCreate().

For container-managed persistence, ejbCreate() returns a void, unlike the case of bean-managed persistence, where it returns a primary key.

Parameters:
accountID - Integer Account ID
initialSalary - double Initial salary
Throws:
javax.ejb.CreateException - if there is a problem creating the bean

ejbCreate

public void ejbCreate(double initialSalary)
               throws javax.ejb.CreateException
This method corresponds to the create method in the home interface "OracleHome.java". The parameter sets of the two methods are identical. When the client calls OracleHome.create(), the container (which in WebLogic EJB is also the home) allocates an instance of this bean and calls OracleBean.ejbCreate().

For bean-managed persistence, ejbCreate() returns a primary key, unlike the case of container-managed persistence, where it returns a void.

Unlike the ejbCreate(Integer accountId, double initialSalary), this version creates a new AccountID using getNewAccountId().

Parameters:
initialSalary - double Initial Salary
Throws:
javax.ejb.CreateException - if there is a problem getting an account ID

ejbPostCreate

public void ejbPostCreate(java.lang.Integer accountId,
                          double initialSalary)
This method is required by the EJB Specification, but is not used by this example.
Parameters:
accountID - Integer Account Identification
initialSalary - double Initial Salary

ejbPostCreate

public void ejbPostCreate(double initialSalary)
This method is required by the EJB Specification, but is not used by this example.
Parameters:
initialSalary - double Initial Salary

salary

public double salary()
Returns current salary.
Returns:
double Salary

accountId

public java.lang.Integer accountId()
Returns account ID.
Returns:
Integer Account ID