象以前, Entity Bean从结构继续,下面是公司Entity Bean的代码片段: public class CompanyBean extends CompanyStrUCt implements EntityBean { EntityContext entityContext; // CMP for all fields in the CompanyStruct public java.util.Collection employees; //one-to-many //rest of the code including getData() and setData() public java.util.Collection getEmployees() { return employees; } }
下面是雇员Entity Bean的程序片段: public class EmployeeBean extends EmployeeStruct implements EntityBean { EntityContext entityContext; //CMP for all fields in EmployeeStruct EXCEPT //the comId public Company company;//remote reference to company }