objEntity.addAttribute(oatr1);
map.addObjEntity(objEntity);
// try to insert some rows to check that pk stuff is working
DataContext ctxt = createDataContext();
DataMap sourceMap = map;//ctxt.getEntityResolver().getDataMap("testmap");
try {
sourceMap.addDbEntity(dbEntity);
sourceMap.addObjEntity(objEntity);
for (int i = 0; i < 5; i++) {
CayenneDataObject dao = (CayenneDataObject) ctxt.newObject(objEntity
.getName());
dao.writeProperty(oatr1.getName(), "test " + i);
}
ctxt.commitChanges();
}
finally {
sourceMap.removeObjEntity(objEntity.getName(), true);
sourceMap.removeDbEntity(dbEntity.getName(), true);
}
// clear up
map.removeObjEntity(objEntity.getName(), true);
map.removeDbEntity(dbEntity.getName(), true);