EJB design mode 1

zhaozj2021-02-16  56

Design mode 1 The first design pattern is very simple. The Entity Bean of a company and the employee and the code segment of the Entity Bean given below are similar. They are generated by the EntityBean template of JBuilder4. All fields are declared as public CMP fields. 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 is exposed in The Remote Interface As Well this design mode is very simple, but there are many shortcomings, for example, access to each field will lead to a remote call to the GET () and set () methods. The remote process call (RPCS) is a very resource-consuming, and access to a combination of common requirements in the actual situation can lead to a series of remote calls. It can be said that this model is very useful in actual use. The design pattern shown above can be used as the foundation of other design patterns, such as RAD, prototype design, testing, etc. At this time, the Employee Estity Bean that represents employees did not show what relations between employees and companies.

转载请注明原文地址:https://www.9cbs.com/read-23874.html

New Post(0)