為了避免設計模式1的缺點,我們介紹一下封裝entity bean值域的value objec的概念。value object,用某些語言的術語來說,就是一個結構類型,因為他們和corba的結構類型非常類似。 value Object code snippet for Company public class CompanyStrUCt implements java.io.Serializable { public Integer comId; //PRimary Key public String comName; public String comDescription; public java.sql.Timestamp mutationDate; } value Object code snippet for Employee public class EmployeeStruct implements java.io.Serializable { public Integer empId; //Primary Key public Integer comId; //Foreign Key public String empFirstName;
public String empLastName; public java.sql.Timestamp mutationDate; }