背景
我的 spring data neo4j 应用程序发出密码错误。
这很奇怪,因为我使用 neo ogm 来管理我所有的 cyper 语句,我自己没有编写任何 cypher。
这是我的错误:
CLI 输出中的密码错误
Error executing Cypher "Neo.ClientError.Statement.SyntaxError"; Code: Neo.ClientError.Statement.SyntaxError; Description: Invalid input '|': expected whitespace, comment, a relationship pattern, '.', node labels, '[', "=~", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR, ',' or ']...
密码错误后 CLI 输出中的 OGM 错误
...nested exception is org.neo4j.ogm.exception.CypherException: Error executing Cypher \"Neo.ClientError.Statement.SyntaxError\"; Code: Neo.ClientError.Statement.SyntaxError; Description: Invalid input '|': expected whitespace, comment, a relationship pattern, '...
在我的代码中定位错误的位置时出错 (GenericService)
...myproject.service.GenericService.find(GenericService.java:39) ~[classes/:na]...
GenericService 第 39 行
Optional<T> object = getRepository().findById(id, depth);
我被困在哪里
findById
在 springframework.data.neo4j.repository.Neo4jRepository.java 中声明为Optional<T> findById(ID id, int depth);
自从我切换到 Spring data neo4j 5.0.0 以来,我最近开始使用 neo4jrepository 而不是 graphrepository。
所以,我想我已经在代码中找到了问题,但它不是我的代码,它是库,但我不能相信最新的 neo4j ogm 发布时存在findById
函数错误。
问题
我如何克服这个密码错误?这个问题可能出自哪里?
更新 1
我正在使用 neo4j-ogm-version 3.0.0,spring-boot 2.0.0.M3,Neo4J 是 3.2.3 和 spring-data-neo4j 5.0.0.RELEASE,
更新 2
会不会是我的 id 被实例化为 aLong
而 Neo4jRepository.java 被实例化为 a ID
?
GenericService.java 中的更多上下文
public T find(Long id) {
Optional<T> object = getRepository().findById(id, DEPTH_ENTITY);
if(object.isPresent())
return object.get();
return null;
}
更新 3
springframework.data.neo4j.repository.Neo4jRepository.java 包含
@NoRepositoryBean
public interface Neo4jRepository<T, ID extends Serializable> extends PagingAndSortingRepository<T, ID> {
<S extends T> S save(S s, int depth);
<S extends T> Iterable<S> save(Iterable<S> entities, int depth);
Optional<T> findById(ID id, int depth);
Iterable<T> findAll();
Iterable<T> findAll(int depth);
Iterable<T> findAll(Sort sort);
Iterable<T> findAll(Sort sort, int depth);
Iterable<T> findAllById(Iterable<ID> ids);
Iterable<T> findAllById(Iterable<ID> ids, int depth);
Iterable<T> findAllById(Iterable<ID> ids, Sort sort);
Iterable<T> findAllById(Iterable<ID> ids, Sort sort, int depth);
/**
* Returns a {@link Page} of entities meeting the paging restriction provided in the {@code Pageable} object.
* {@link Page#getTotalPages()} returns an estimation of the total number of pages and should not be relied upon for accuracy.
*
* @param pageable
* @return a page of entities
*/
Page<T> findAll(Pageable pageable);
/**
* Returns a {@link Page} of entities meeting the paging restriction provided in the {@code Pageable} object.
* {@link Page#getTotalPages()} returns an estimation of the total number of pages and should not be relied upon for accuracy.
*
* @param pageable
* @param depth
* @return a page of entities
*/
Page<T> findAll(Pageable pageable, int depth);
}