db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Bengtson <e...@jpox.org>
Subject TCK company model and managed associations
Date Fri, 07 Apr 2006 15:33:15 GMT
Hi,

According JDO, is it necessary to set the value of a 1-1 bidirectional on both
values?

Thanks,

ICompany com = (ICompany) pm.newInstance(ICompany.class);
com.setCompanyid(1);
com.setName("c1");

IAddress address = (IAddress) pm.newInstance(IAddress.class);
address.setAddrid(1);
com.setAddress(address);

HashSet setDept = new HashSet();
com.setDepartments(setDept);

IDepartment dept = (IDepartment) pm.newInstance(IDepartment.class);
setDept.add(dept);
dept.setDeptid(1);

HashSet set1 = new HashSet();
dept.setEmployees(set1);

IPartTimeEmployee p1 = (IPartTimeEmployee)
pm.newInstance(IPartTimeEmployee.class);
p1.setPersonid(1);
p1.setBirthdate(new Date());
p1.setFirstname("p1");
set1.add(p1);

IFullTimeEmployee p2 = (IFullTimeEmployee)
pm.newInstance(IFullTimeEmployee.class);
p2.setPersonid(2);
p2.setBirthdate(new Date());
p2.setFirstname("p2");
p2.setSalary(2);

IDentalInsurance di1 = (IDentalInsurance)
pm.newInstance(IDentalInsurance.class);
di1.setInsid(1);
di1.setCarrier("Carrier");
di1.setEmployee(p2); // <----not managed relation? ##############
p2.setDentalInsurance(di1);
set1.add(p2);


Mime
View raw message