假設有兩個節點實體: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