我已经使用javascript函数添加了多个节点,并希望在我尝试编写for循环时添加边连接它们,它会引发以下异常:
com.orientechnologies.orient.core.exception.OSerializationException:无法序列化无效链接:嵌入式会话中的#57:-2
如果我在没有for循环的情况下编写相同的查询,它将被执行。
var g = orient.getGraph();
for (var i = 0 ; i < 5 ; i ++ ){
var title ="post_0";
var company_name = "Company_0";
var c = "create edge HasInterest from (select from post where Title = '" +
title + "') to (select from Interest where Name = 'Recruitment')";
g.command("sql",c,[]);
}
答案 0 :(得分:0)
您缺少commit()语句,因为您正在使用循环:
var g = orient.getGraph();
for (var i = 0 ; i < 5 ; i ++ )
{
var title = "post_" + i;
var company_name = "Company_" + i;
var c = "create edge HasInterest from (select from post where Title = '" +
title + "') to (select from Interest where Name = 'Recruitment')";
g.command("sql",c,[]);
g.commit();
}