// DeptBean.java

package hr;

import javax.ejb.*;
import java.rmi.*;
import java.util.*;

public abstract class DeptBean implements EntityBean
{

    private EntityContext ectx;

    // getters and setters for cmp fields
    // ===========================================================

    public abstract Integer getDeptNo();
    public abstract void setDeptNo(Integer deptNo);

    public abstract String getDeptName();
    public abstract void setDeptName(String deptName);

    // getters and setters for relationship fields
    // ===========================================================

    // 1:m
    public abstract Collection getEmployees();
    public abstract void setEmployees(Collection employees);

    // ===========================================================

    public Integer ejbCreate(Dept dept) throws CreateException
    {
        setDeptNo(dept.getDeptNo());
        setDeptName(dept.getDeptName());
        return null;
    }

    public void ejbPostCreate(Dept dept) 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 ectx)
    {
        this.ectx = ectx;
    }

    public void unsetEntityContext()
    {
        this.ectx = null;
    }

}
