我的关系创建挂起,但下面的节点设法坚持到我的远程客户端。
public class Baz
{
private static enum CustomRelationships implements RelationshipType {
CATEGORY
}
public void foo()
{
RestGraphDatabse db = new RestGraphDatabase("http://remoteIp:7474/db/data",username,password);
Transaction tx = db.beginTx();
try{
Node a = db.createNode();
a.setProperty("foo", "foo"); // finishes
Node b = db.createNode();
b.setProperty("bar", "bar"); //finishes
a.createRelationshipTo(b, CustomRelationships .CATEGORY); // hangs
System.out.println("Finished relationship");
tx.success();
} finally {
tx.finish();
}
}
}
我不知道为什么。没有堆栈,连接不会超时。
a.createRelationshipTo(b, DynamicRelationshipType.withName("CATEGORY"));
也挂了
此查询可以从管理 shell 正确执行:
start first=node(19), second=node(20) 创建 first-[r:RELTYPE { links : first.Baz + '<-->' + second.BazCat }]->second return r
然而,当以这种方式运行时:
ExecutionResult result = engine.execute("start first=node("
+ entityNode.getId() + "), second=node("
+ categoryNode.getId() + ") "
+ " Create first-[r:RELTYPE { linkage : first.Baz"
+ " + '<-->' + second.BazCat" + " }]->second return r");
也挂了。