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 = clazz.getCanonicalName();
}
Table c = cIndex.get(registryName);
if (c == null)
throw new MException("class definition not found in schema",registryName);
try {
// prepare object
schema.doPreRemove(c,object,con,this);
//save object
c.removeObject(con,object);
schema.doPostRemove(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();
}
}