我们正在从 Tinkerpop 2.6 迁移到 MMAPI,但可以找到创建具有强制值的顶点的方法。在 Tinkerpop 中,我们这样做:
OrientGraphFactory factory = new OrientGraphFactory(“remote:localhost/ogm-test”, “root”, “toor”).setupPool(1, 10);
OrientGraph g = factory.getTx();
OrientVertex v1 = g.addVertex(“class:SimpleVertexEx”,“svex”,“directTest”);
在 MMAPI 中:
OrientDB dbServer = new OrientDB(“remote:localhost”,OrientDBConfig.defaultConfig());
ODatabaseSession db = dbServer.open(“ogm-test”, “root”, “toor”);
db.begin();
OVertex v1 = db.newVertex(“class:SimpleVertexEx”);
v1.setProperty(“svex”,“directTest”);
v1.save();
但这在 newVertex 行失败。我们必须如何做到这一点?