Code snippet for Company Entity Bean
public class CompanyBean implements EntityBean {
EntityContext entityContext;
public Integer comId; //the primary key
public String comName; //the company name
public String comDescription //basic description
public Timestamp mutationDate //explained later
public Integer ejbCreate() throws
CreateException {
return null;
}
//various get() and set() for every column/field
// which are exposed in the Remote Interface as well Code snippet for Employee Entity Bean
public class EmployeeBean implements EntityBean {
EntityContext entityContext;
public Integer empId; //the primary key
public Integer comId; //the company foreign key
public String empFirstName; //the employee firstname
public String empLastName; // the employee lastname
public Timestamp mutationDate; //explained later
public Integer ejbCreate() throws
CreateException {
return null;
}
//various get() and set() for every column/field
// which are exposed in the Remote Interface as well
这个设计模式虽然很简单,但是却有很多缺点,比如,对每一个字段的访问都会导致对get()和set()方法的一次远程调用。而远程过程调用(RPCs)是非常耗费资源的,并且,对于在实际中通常要求的组合的访问会导致一系列的远程调用。可以说,这个模式在实际中可用性很差。上面展示的设计模式可以作为其他设计模式的基础,比如RAD,原型设计,测试等。这时,那个代表雇员的Employee Entity Bean并没有展示出在雇员和公司之间有何关系。
本文来自 280文秘网(https://www.it280.com),转载请保留网址和出处
【软件设计:EJB设计模式1】相关文章:
分式的乘方和乘方法则02-08
分手了给女友道歉信挽回信模板02-08
2016年12月大学英语四级写作之议论文精讲(1)02-08
安全工程师考试《安全生产管理》第七讲讲义精选(1)02-08
2021上半年北京软考报名时间02-08
2020年江西执业医师网上报名和现场审核时间公布【附报考条件】02-08
2013年小学教学工作计划02-08
