edu.rice.rubis.beans
Class RegionBean

java.lang.Object
  |
  +--edu.rice.rubis.beans.RegionBean
All Implemented Interfaces:
javax.ejb.EnterpriseBean, javax.ejb.EntityBean, java.io.Serializable

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

RegionBean is an entity bean with "container managed persistence". The state of an instance is stored into a relational database. The following table should exist:

 CREATE TABLE regions (
    id   INTEGER UNSIGNED NOT NULL UNIQUE,
    name VARCHAR(20),
    PRIMARY KEY(id)
 );
 

Version:
1.0
Author:
Emmanuel Cecchet and Julie Marguerite
See Also:
Serialized Form

Field Summary
 java.lang.Integer id
           
 java.lang.String name
           
 
Constructor Summary
RegionBean()
           
 
Method Summary
 void ejbActivate()
          This method is empty because persistence is managed by the container
 RegionPK ejbCreate(java.lang.String regionName)
          This method is used to create a new Region Bean.
 void ejbLoad()
          Persistence is managed by the container and the bean becomes up to date
 void ejbPassivate()
          This method is empty because persistence is managed by the container
 void ejbPostCreate(java.lang.String regionName)
          This method just set an internal flag to reload the id generated by the DB
 void ejbRemove()
          This method is empty because persistence is managed by the container
 void ejbStore()
          Persistence is managed by the container and the bean becomes up to date
 java.lang.Integer getId()
          Get region's id.
 java.lang.String getName()
          Get region name.
 boolean isModified()
          Returns true if the beans has been modified.
 void setEntityContext(javax.ejb.EntityContext context)
          Sets the associated entity context.
 void setName(java.lang.String newName)
          Set region's name
 void unsetEntityContext()
          Unsets the associated entity context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

public java.lang.Integer id

name

public java.lang.String name
Constructor Detail

RegionBean

public RegionBean()
Method Detail

getId

public java.lang.Integer getId()
Get region's id.
Returns:
region id

getName

public java.lang.String getName()
Get region name.
Returns:
region name

setName

public void setName(java.lang.String newName)
Set region's name
Parameters:
newName - region name

ejbCreate

public RegionPK ejbCreate(java.lang.String regionName)
                   throws javax.ejb.CreateException
This method is used to create a new Region Bean. Note that the region id is automatically generated by the database (AUTO_INCREMENT) on the primary key.
Parameters:
regionName - Region name
Returns:
pk primary key set to null
Throws:
javax.ejb.CreateException - if an error occurs

ejbPostCreate

public void ejbPostCreate(java.lang.String regionName)
This method just set an internal flag to reload the id generated by the DB

ejbLoad

public void ejbLoad()
Persistence is managed by the container and the bean becomes up to date
Specified by:
ejbLoad in interface javax.ejb.EntityBean

ejbStore

public void ejbStore()
Persistence is managed by the container and the bean becomes up to date
Specified by:
ejbStore in interface javax.ejb.EntityBean

ejbActivate

public void ejbActivate()
This method is empty because persistence is managed by the container
Specified by:
ejbActivate in interface javax.ejb.EntityBean

ejbPassivate

public void ejbPassivate()
This method is empty because persistence is managed by the container
Specified by:
ejbPassivate in interface javax.ejb.EntityBean

ejbRemove

public void ejbRemove()
This method is empty because persistence is managed by the container
Specified by:
ejbRemove in interface javax.ejb.EntityBean

setEntityContext

public void setEntityContext(javax.ejb.EntityContext context)
Sets the associated entity context. The container invokes this method on an instance after the instance has been created. This method is called in an unspecified transaction context.
Specified by:
setEntityContext in interface javax.ejb.EntityBean
Parameters:
context - An EntityContext interface for the instance. The instance should store the reference to the context in an instance variable.
Throws:
javax.ejb.EJBException - Thrown by the method to indicate a failure caused by a system-level error.

unsetEntityContext

public void unsetEntityContext()
Unsets the associated entity context. The container calls this method before removing the instance. This is the last method that the container invokes on the instance. The Java garbage collector will eventually invoke the finalize() method on the instance. This method is called in an unspecified transaction context.
Specified by:
unsetEntityContext in interface javax.ejb.EntityBean
Throws:
javax.ejb.EJBException - Thrown by the method to indicate a failure caused by a system-level error.

isModified

public boolean isModified()
Returns true if the beans has been modified. It prevents the EJB server from reloading a bean that has not been modified.
Returns:
a boolean value


Copyright © 2003 - ObjectWeb Consortium - All Rights Reserved.