V
VRGL
Unregistered / Unconfirmed
GUEST, unregistred user!
Design Pattern I
The first design pattern is extremely simple. The Entity Bean code snippet for the
Company &
Employee beans would be similar to the code below. This is the default
code generated by the JBuilder? 4 Entity Bean Modeler. All the fields declared
public are 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
This design pattern, though extremely simple has quite a few disadvantages, such as
one remote call is required to get() and set() every field. Remote Procedure
Calls (RPCs) are quite expensive and when combined with the fact that every access
requires a transaction to be associated with it as well, this pattern is not usable in
production environments. The framework shown above can be used as a stepping-stone
for other design patterns and/or RAD, prototyping, testing, etc. At this stage,
the Employee Entity Beando
es not model the relationship between the Employee
and the Company.
The first design pattern is extremely simple. The Entity Bean code snippet for the
Company &
Employee beans would be similar to the code below. This is the default
code generated by the JBuilder? 4 Entity Bean Modeler. All the fields declared
public are 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
This design pattern, though extremely simple has quite a few disadvantages, such as
one remote call is required to get() and set() every field. Remote Procedure
Calls (RPCs) are quite expensive and when combined with the fact that every access
requires a transaction to be associated with it as well, this pattern is not usable in
production environments. The framework shown above can be used as a stepping-stone
for other design patterns and/or RAD, prototyping, testing, etc. At this stage,
the Employee Entity Beando
es not model the relationship between the Employee
and the Company.