。。

解决方案 »

  1.   

    import java.rmi.RemoteException;
    import java.security.Identity;
    import java.util.Properties;
    import javax.ejb.*;
    import com.ibm.uxo.bestpractices.datamodels.*;public class EmployeeRosterBean implements SessionBean {
    private EmployeeHome employeeHome;
    private javax.ejb.SessionContext mySessionCtx = null;
    final static long serialVersionUID = 3206093459760846163L;public void ejbCreate() throws javax.ejb.CreateException,
    java.rmi.RemoteException {
    employeeHome = EmployeeEjbHomeCacheHelper.getEmployeeHome()}public EmployeeStruct getEmployeeInfoFor(String empno) {
    Employee theEmployee = null;
    EmployeeStructure returnValue = new EmployeeStructure();try {
    theEmployee = employeeFindByPrimaryKey(new EmployeeKey(empno));returnValue.setSex(theEmployee.getSex());
    returnValue.setSalary(theEmployee.getSalary());
    returnValue.setPhoneno(theEmployee.getPhoneno());
    returnValue.setMidinit(theEmployee.getMidinit());
    returnValue.setLastname(theEmployee.getLastname());
    returnValue.setJob(theEmployee.getJob());
    returnValue.setHiredate(theEmployee.getHiredate());
    returnValue.setFirstnme(theEmployee.getFirstnme());
    returnValue.setEmpno(empno);
    returnValue.setEdlevel(theEmployee.getEdlevel());
    returnValue.setComm(theEmployee.getComm());
    returnValue.setBonus(theEmployee.getBonus());
    returnValue.setBirthdate(theEmployee.getBirthdate());
    returnValue.setWorkDept(theEmployee.getWorkdept());
    } catch (Exception e) {
    e.printStackTrace();
    }
    return returnValue;
    }public void ejbActivate() throws java.rmi.RemoteException {}
    public void ejbPassivate() throws java.rmi.RemoteException {}
    public voide ejbRemove() throws java.rmi.RemoteException {}
    }
      

  2.   

    有个超级好帖子:
    http://www.sun.com/bigadmin/hubs/multilingual/simp_chinese/content/TechTips_Feb07.jsp
      

  3.   

      今天看了下无状态和有状态的session bean
      实在是看天书,到底EJB的存在是为了解决什么问题 ??
      spring做管理,hibernate做取数据,那么ejb做什么呢 ??
      我看了那个佛山人的PDF,也许正因为存在着无状态的session bean,好处就是可以在节约系统内存的前提上加入存取数据和界面之间,他的作用是在存取数据中节约开销,我的理解对么??
      Remote 与Local 接口是什么,有什么区别 ?
      谁知道的麻烦说下,谢谢 !!!