国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

EJB設(shè)計(jì)模式(1)

2019-11-18 14:44:22
字體:
供稿:網(wǎng)友

  EJB設(shè)計(jì)模式(1)
第一個(gè)設(shè)計(jì)模式非常簡(jiǎn)單。一個(gè)公司和雇員的Entity Bean和下面給出的Entity Bean的代碼片斷是類似的。它們是由jbuilder4的 EntityBean模版生成的。所有的字段都聲明為public的cmp字段。


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(<params>) 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(<params>) throws
CreateException {
return null;
}
//various get() and set() for every column/field
// which are exposed in the Remote Interface as well


這個(gè)設(shè)計(jì)模式雖然很簡(jiǎn)單,但是卻有很多缺點(diǎn),比如,對(duì)每一個(gè)字段的訪問都會(huì)導(dǎo)致對(duì)get()和set()方法的一次遠(yuǎn)程調(diào)用。而遠(yuǎn)程過程調(diào)用(RPCs)是非常耗費(fèi)資源的,并且,對(duì)于在實(shí)際中通
常要求的組合的訪問會(huì)導(dǎo)致一系列的遠(yuǎn)程調(diào)用。可以說,這個(gè)模式在實(shí)際中可用性很差。上面展示的設(shè)計(jì)模式可以作為其他設(shè)計(jì)模式的基礎(chǔ),比如RAD,原型設(shè)計(jì),測(cè)試等。這時(shí),那個(gè)代表雇員的Employee Entity Bean并沒有展示出在雇員和公司之間有何關(guān)系。(未完待續(xù))

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 措美县| 连山| 思南县| 图片| 东平县| 托克托县| 浮山县| 依安县| 民县| 碌曲县| 茂名市| 曲麻莱县| 安新县| 吴堡县| 东光县| 泸州市| 西峡县| 万盛区| 邮箱| 永城市| 武义县| 邹平县| 虎林市| 龙门县| 银川市| 湘西| 宣武区| 静海县| 舟曲县| 巴彦淖尔市| 达尔| 大连市| 右玉县| 清丰县| 林口县| 台中市| 湖北省| 雅江县| 镶黄旗| 九龙城区| 南涧|