【发布时间】:2014-01-30 21:19:22
【问题描述】:
我无法发现我做错了什么。我可以使用硬编码值在 neo4j 控制台上运行查询。
我正在尝试对我的存储库类执行以下查询:
@Query("START user=node({0}) \n" +
"MATCH (anotherUser) \n" +
"WHERE NOT (anotherUser<-[:MATCHES]-user) AND NOT user = anotherUser \n" +
"RETURN anotherUser")
Iterable<User> findMatchesForUser(User user);
查询的结果应该是我作为参数传递的用户之间没有 :MATCHES 边缘的所有用户节点。
我得到以下异常:
SEVERE: Servlet.service() for servlet [mvc-dispatcher] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START user=node({0})
MATCH (anotherUser)
WHERE NOT (anotherUser<-[:MATCHES]-user) AND NOT user = anotherUser
RETURN anotherUser; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START user=node({0})
MATCH (anotherUser)
WHERE NOT (anotherUser<-[:MATCHES]-user) AND NOT user = anotherUser
RETURN anotherUser; nested exception is `,' expected but `W' found
我也相信它与示例 here 是一致的。任何提示将不胜感激。
【问题讨论】:
-
你使用哪个版本?
-
Spring 3.2、Spring-Data-neo4j 2.3.2 和 neo4j 1.8。我一直无法让 neo4j 2.0 运行,我在构建时遇到了“Unsupported major.minor version 51.0”,并决定暂时坚持使用 1.8。
-
如果不能选择 2.0,我强烈建议升级到 Neo4j 1.9。为什么要坚持1.8?迁移应该不会太难,如果有的话。
-
这是一个密码错误,所以你的查询在执行时被破坏了。
-
也许您可以启用密码查询日志记录。我认为将
org.neo4j.cypher的日志级别设置为 DEBUG 会有所帮助
标签: neo4j spring-data spring-data-neo4j spring-data-graph