请教各位,我再springboot上使用neo4j带参数查询会提示语法错误,不带参数的查询就可以执行
这是我写的dao:
@Repository
public interface UserDao extends Neo4jRepository<User, Long> {
@Query("match (u:User) return u")
List<User> list();
@Query("match (u:User) where u.username={var} return u")
User findByUsername(@Param("var") String username);
}
这是报错信息:
org.springframework.dao.InvalidDataAccessResourceUsageException: Invalid input '{': expected "+" or "-" (line 1, column 33 (offset: 32))
"match (u:User) where u.username={var} return u"
^; Error code 'Neo.ClientError.Statement.SyntaxError'
Caused by: org.neo4j.driver.exceptions.ClientException: Invalid input '{': expected "+" or "-" (line 1, column 33 (offset: 32))
"match (u:User) where u.username={var} return u"
^