* session ref bound to it.
* @param oc the session ref to the target db to clear
*/
private static void clearDb4oDb(ObjectContainer oc) {
if(oc == null) return;
final ExtObjectContainer s = oc.ext();
final ReflectClass[] rcs = s.knownClasses();
if(rcs != null) {
for(final ReflectClass rc : rcs) {
if(rc.getDelegate() instanceof JdkClass) {
final Class<?> objType = ((JdkClass) rc.getDelegate()).getJavaClass();
final String cn = objType.getName();
if(cn.indexOf("com.db4o") < 0 && objType != Object.class && cn.indexOf("java") < 0) {
final Collection<?> clc = s.query(objType);
if(clc != null) {
for(final Object o : clc) {
log.debug("Removing object: " + o);
s.delete(o);
}
}
}
}
}
s.purge();
}
}