bug of setProperty("abc", ArrayList<Object> ) of OrientGraph
I using a ArrayList to save the child-edge's id, the arraylist is saved the parent vertex by set setProperty. But when I arraylist.get(0), the return value is a Edge not the id of the Edge.
the code:
public EdgeVertex[] getChildren(Vertex parent)
{
ArrayList<Object> edgeIDsToChildren = getEdgeIDsToChildren(parent);
if (edgeIDsToChildren == null)
{
return null;
}
else
{
EdgeVertex [] children = new EdgeVertex[edgeIDsToChildren.size()];
System.out.println (edgeIDsToChildren);
System.out.println (edgeIDsToChildren.get(0));
System.out.println (edgeIDsToChildren);
System.out.println (edgeIDsToChildren.get(1));
for (int i=0; i<children.length; i++)
{
Edge edgeToChild = getEdge(edgeIDsToChildren.get(i));
Vertex child = getChildOnEdge(edgeToChild);
children [i] = new EdgeVertex(edgeToChild, child);
}
return children;
}
}
the printed string is
[#9:0, #9:5, #9:10] E#9:0{out:#8:0,in:#8:1,label:null,_edgeType:0} v1 [E#9:0{out:#8:0,in:#8:1,label:null,_edgeType:0} v1, #9:5, #9:10] E#9:5{out:#8:0,in:#8:5,label:null,_edgeType:0} v1
This is not a bug but a feature: the RID are lazily loaded. To avoid this you can set disable this behavior by:
edgeIDsToChildren.setAutoConvertToRecord(false);
but when I use blueprints, I don't want to care the details of Orientdb. I don't know that ArrayList is changed to a OrientLazyList(Sorry I forgot its true name). And I have two questions: 1st: When I setProperty a java array or a LinkedList, will It be changed to a OrientLazyList ? 2nd: Can I close the feature, in blueprints OrientGraph method ?
You can disable lazy loading only by such way. Or you could store not the RID but a string. In this way the lazy loading doesn't work.
Thanks very much! I think setAutoConvertToRecord(false) is better