Given a com.orientechnologies.orient.core.db.ODatabase<T>
object, what's the best programmatical way (no sql, no console script) to clear the database (that's erase each and every object but respect the existing schema)?
Based on Alessandro's comment and rmuller's answer to this question, I've built a java helper method.
db.getMetadata().getSchema().getClasses().stream()
.filter(oClass -> !oClass.getName().startsWith(ORIENTDB_CLASS_PREFIX)) //
.forEach(oClass -> {
try {
oClass.truncate();
} catch (IOException e) {
LOGGER.warn("Not possible to truncate class " + oClass.getName(), e);
}
});