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

首頁 > 學院 > 開發設計 > 正文

EJB設計模式1

2019-11-18 12:36:22
字體:
來源:轉載
供稿:網友

  第一個設計模式非常簡單。一個公司和雇員的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() 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并沒有展示出在雇員和公司之間有何關系。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 丹东市| 伊川县| 靖江市| 新绛县| 铁岭市| 全州县| 富锦市| 中西区| 独山县| 西华县| 连南| 隆昌县| 蒙城县| 阳城县| 万安县| 潞城市| 玉门市| 抚顺市| 房产| 赤水市| 武乡县| 固阳县| 望都县| 泽库县| 普宁市| 毕节市| 湘西| 乌兰县| 榆林市| 健康| 大同县| 辉县市| 株洲县| 高邑县| 得荣县| 永昌县| 且末县| 浠水县| 墨脱县| 喀什市| 麻江县|