假设有两个节点实体:Neo4j的 - 简单的暗号查询
public class Account extends BaseEntity
{
...
@Fetch
@RelatedTo(type = "HAS_ROLE")
private Set<Role> roles = Sets.newHashSet();
...
}
public class Role extends BaseEntity
{
...
}
在我的仓库,我有一个查询,应该由一个给定的角色获得的所有帐户:
public interface AccountRepository extends GraphRepository<Account>
{
@Query("START account=node:Account(0) MATCH account-[:HAS_ROLE]->({0}) return account")
Iterable<Account> findByRole(Role role);
}
但此查询不工作,当我在我的测试中使用此方法,我得到了以下错误:
org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START account=node:Account(0) MATCH account-[:HAS_ROLE]->({0}) return account; nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException: Error executing statement START account=node:Account(0) MATCH account-[:HAS_ROLE]->({0}) return account; nested exception is expected string
,因为它似乎有个东西W¯¯荣与我的查询,但我不知道什么,并不能解决它...... 任何人都可以提供一些帮助?
请指定使用的Neo4j的版本,这很重要。 – raina77ow
我正在使用neo4j 1.8.M07,spring-data-neo4j 2.1.0.BUILD-SNAPSHOT –
请接受您的答案或回答(并接受)。它看起来像你有一个解决方案(“我改变了......,一切都很好”),这将是很好的关闭这个问题! – cod3monk3y