if (con == null) {
try {
myCon = pool.getConnection();
con = myCon;
} catch (Throwable t) {
throw new MException(t);
}
}
if (registryName == null) {
Class<?> clazz = schema.findClassForObject(object,this);
if (clazz == null)
throw new MException("class definition not found for object",object.getClass().getCanonicalName(),registryName);
registryName = clazz.getCanonicalName();
}
Table c = cIndex.get(registryName);
if (c == null)
throw new MException("class definition not found in schema",registryName);
LinkedList<Object> keys = new LinkedList<Object>();
try {
for (Field f : c.getPrimaryKeys()) {
keys.add(f.getFromTarget(object));
}
if (c.fillObject(con,object,keys.toArray()) == null)
throw new MException("object not found");
schema.doPostLoad(c,object,con,this);
} catch (Throwable t) {
throw new MException(registryName,t);
}
if (myCon != null) {
try {
myCon.commit();
} catch (Throwable t) {
throw new MException(t);
}
myCon.close();
}
}