0
我想在Neo4j中堅持一段關係,但不起作用。查看我的查詢。我的域對象與它自己有這種關係。保存neo4j中的關係
@RelatedTo (type="PLUS_ME", direction = Direction.BOTH)
private Set<Errand> plusMe;
然後我用GraphRepository運行這個查詢。
Errand e = new Errand();
Errand e1 = new Errand();
e = template.save(e);
e1 = template.save(e1);
p (e.getId() + " " + e1.getId());
String query = "MATCH (one:Errand)" +
"WHERE one.id = " + e.getId() +
"MATCH (two:Errand)" +
"WHERE two.id = " + e1.getId() +
"CREATE (one)-[b:PLUS_ME]->(two)" +
"CREATE (two)-[a:PLUS_ME]->(one)";
eRepo.query(query, null);
但是當我用junit運行這個查詢時,我得到0作爲大小。
eRepo.findByPlusMe(e).size();