我正努力让它发挥作用。这只是来自(假设的)文档的简单代码和平,虽然它没有错误,但数据库中没有任何改变!我看不到名为V1的新类!我使用的是2.0.7和Java 1.7
OrientGraphFactory factory = new OrientGraphFactory("plocal:D:/orientdb/databases/GratefulDeadConcerts");
OrientGraphNoTx graph = factory.getNoTx();
try{
OClass V = graph.getRawGraph().getMetadata().getSchema().getClass("V");
OClass V1 = graph.getRawGraph().getMetadata().getSchema().createClass("V1", V);
V1.createProperty("prop1", OType.STRING);
V1.createProperty("prop2", OType.STRING);
ODocument od = new ODocument(V1);
od.field("prop1", "value1");
od.field("prop2", "value2");
od.save();
} catch( Exception e ) {
System.out.println("ERROR:"+e.getMessage());
graph.rollback();
}
finally {
graph.shutdown();
factory.close();
}