catch (Exception ex) {
throw new CayenneRuntimeException("Error instantiating object.", ex);
}
// this will initialize to-many lists
descriptor.injectValueHolders(object);
ObjectId id = new ObjectId(entityName);
// note that the order of initialization of persistence artifacts below is
// important - do not change it lightly