OrientDB 从 2.0.12 迁移到 2.2.18
OrientDB migration from 2.0.12 to 2.2.18
我在下面使用 API 来获取 2.0.12 中的顶点并且它正在工作
OrientGraphFactory factory = new OrientGraphFactory("remote:172.21.112.228/mydb", "root", "root").setupPool(1,50);
OrientGraphNoTx 图 = factory.getNoTx();
graph.getVertices("Test.name","zyx");
但是使用最新的 2.2.18,当我尝试
OrientGraphFactory factory = new OrientGraphFactory("memory:172.21.112.228/mydb", "root", "root").setupPool(1,50);
OrientGraphNoTx 图 = factory.getNoTx();
graph.getVertices("Test.name","zyx");
我遇到了以下错误,
线程中出现异常 "main" java.lang.IllegalArgumentException:在架构中找不到 OClass:测试
在 com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.getVertices(OrientBaseGraph.java:814)
在 test.GetOrientDBData.main(GetOrientDBData.java:57)
试试下面的代码:
OrientGraphFactory factory = new OrientGraphFactory("memory:mydb",
"root", "root").setupPool(1,50);
OrientGraphNoTx graph = factory.getNoTx();
if(g.getVertexType("Test") == null){
g.createVertexType("Test");
}
graph.getVertices("Test.name","zyx");
您的代码有两处更改:
删除了内存中的IP:URL,不需要了
添加了一个检查以确保测试 class 存在并创建它
我在下面使用 API 来获取 2.0.12 中的顶点并且它正在工作
OrientGraphFactory factory = new OrientGraphFactory("remote:172.21.112.228/mydb", "root", "root").setupPool(1,50); OrientGraphNoTx 图 = factory.getNoTx(); graph.getVertices("Test.name","zyx");
但是使用最新的 2.2.18,当我尝试
OrientGraphFactory factory = new OrientGraphFactory("memory:172.21.112.228/mydb", "root", "root").setupPool(1,50); OrientGraphNoTx 图 = factory.getNoTx(); graph.getVertices("Test.name","zyx");
我遇到了以下错误,
线程中出现异常 "main" java.lang.IllegalArgumentException:在架构中找不到 OClass:测试 在 com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.getVertices(OrientBaseGraph.java:814) 在 test.GetOrientDBData.main(GetOrientDBData.java:57)
试试下面的代码:
OrientGraphFactory factory = new OrientGraphFactory("memory:mydb",
"root", "root").setupPool(1,50);
OrientGraphNoTx graph = factory.getNoTx();
if(g.getVertexType("Test") == null){
g.createVertexType("Test");
}
graph.getVertices("Test.name","zyx");
您的代码有两处更改:
删除了内存中的IP:URL,不需要了
添加了一个检查以确保测试 class 存在并创建它