Assume there are two node entities:
public class Account extends BaseEntity
{
...
@Fetch
@RelatedTo(type = "HAS_ROLE")
private Set<Role> roles = Sets.newHashSet();
...
}
public class Role extends BaseEntity
{
...
}
In my repository, I have a Query that should get all Accounts by a given Role:
public interface AccountRepository extends GraphRepository<Account>
{
@Query("START account=node:Account(0) MATCH account-[:HAS_ROLE]->({0}) return account")
Iterable<Account> findByRole(Role role);
}
But this query doesn't work, when I use this method in my test case I get the following error:
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
As it seems, there is something wrong with my query, but I don't know what, and could't figure it out yet... Could anyone provide some help?