use of org.apache.cayenne.testdo.inheritance_people.CustomerRepresentative in project cayenne by apache.
the class SingleTableInheritanceIT method testSave.
@Test
public void testSave() throws Exception {
ClientCompany company = context.newObject(ClientCompany.class);
company.setName("Boeing");
CustomerRepresentative rep = context.newObject(CustomerRepresentative.class);
rep.setName("Joe Schmoe");
rep.setToClientCompany(company);
rep.setPersonType("C");
Employee employee = context.newObject(Employee.class);
employee.setName("Our Joe Schmoe");
employee.setPersonType("E");
context.commitChanges();
context.invalidateObjects(company, rep, employee);
SelectQuery query = new SelectQuery(CustomerRepresentative.class);
List<?> reps = context2.performQuery(query);
assertEquals(1, reps.size());
assertEquals(1, countObjectOfClass(reps, CustomerRepresentative.class));
}
Aggregations