2015-10-08 36 views
0

我有一大堆ODocument記錄的數據庫。他們有他們自己的類層次結構,它不延伸V.我正在添加新的集合,並支持一些功能 - 我們想使用圖形數據庫功能的過程中。OrientDB創建Vertex和ODocument之間的邊界

所以我創建了一個新的頂點每
Vertex company = graph.addVertex(null);

我發現我的存在沃達柯,轉換至頂點作爲

Vertex person = null; for (Vertex v : graph.getVertices("Person.name", "Jay")) { person = v; }

,並嘗試創建邊緣

Edge sessionInIncident = graph.addEdge(null, company, person, "employs"); 

邊緣創建導致以下內容

Class 'Person' is not an instance of V 
java.lang.IllegalArgumentException 
at com.tinkerpop.blueprints.impls.orient.OrientElement.checkForClassInSchema(OrientElement.java:635) 
at com.tinkerpop.blueprints.impls.orient.OrientVertex.addEdge(OrientVertex.java:905) 
at com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.addEdge(OrientBaseGraph.java:685) 

回答

0

爲了一個頂點,類Person必須擴展V類。試試這個命令:

alter class Person superclass V 
+0

謝謝,這正是我一直在尋找的! –