}
public void testInsert() {
CompoundPkTestEntity master = ctxt
.newObject(CompoundPkTestEntity.class);
CompoundFkTestEntity detail = ctxt
.newObject(CompoundFkTestEntity.class);
master.addToCompoundFkArray(detail);
master.setName("m1");
master.setKey1("key11");
master.setKey2("key21");
detail.setName("d1");
ctxt.commitChanges();
// reset context
ctxt = createDataContext();
SelectQuery q = new SelectQuery(CompoundPkTestEntity.class);
List<?> objs = ctxt.performQuery(q);
assertEquals(1, objs.size());
master = (CompoundPkTestEntity) objs.get(0);
assertEquals("m1", master.getName());
List<?> details = master.getCompoundFkArray();
assertEquals(1, details.size());
detail = (CompoundFkTestEntity) details.get(0);
assertEquals("d1", detail.getName());
}