EJB Object class
public abstract class PlanBean implements EntityBean {
private EntityContext ctx;
// container-managed persistent fields accessors
public abstract Integer getPlanNo();
public abstract void setPlanNo(Integer planNo);
public abstract String getPlanName();
public abstract void setPlanName(String planName);
public void PlanBean() {
// Empty constructor, don't initialize here but in the create().
// passivate() may destroy these attributes in the case of pooling
}
public PlanPK ejbCreate(Integer planNo, String planName)
throws CreateException {
setPlanNo(planNo);
setPlanName(planName);
return new PlanPK(planNo);
}
public void ejbPostCreate(Integer planNo, String planName)
throws CreateException {
// when just after bean created
}
public void ejbStore() {
// when bean persisted
}
public void ejbLoad() {
// when bean loaded
}
public void ejbRemove() {
// when bean removed
}
public void ejbActivate() {
// when bean activated
}
public void ejbPassivate() {
// when bean deactivated
}
public void setEntityContext(EntityContext ctx) {
this.ctx = ctx;
}
public void unsetEntityContext() {
this.ctx = null;
}
}
EJBHome Object class:
public interface PlanHome extends EJBHome {
public Plan create(Integer planNo, String planName)
throws CreateException, RemoteException;
public Plan findByPrimaryKey(PlanPK pk)
throws FinderException, RemoteException;
public Collection findByName(String planName)
throws FinderException, RemoteException;
public Collection findAll()
throws FinderException, RemoteException;
}
Remote Interface:
public interface Plan extends EJBObject {
// container-managed persistent fields accessors
public Integer getPlanNo() throws RemoteException;
public void setPlanNo(Integer empNo) throws RemoteException;
public String getPlanName() throws RemoteException;
public void setPlanName(String planName) throws RemoteException;
}