如果我激活“-parameters”编译器的参数,SDN 将不起作用
SDN doesn't work if I activate `-parameters` compiler's argument
我使用 Spring Data Neo4j 4.2.0.RELEASE 并遇到以下异常:
org.neo4j.ogm.exception.CypherException: Error executing Cypher "Neo.ClientError.Statement.ParameterMissing"; Code: Neo.ClientError.Statement.ParameterMissing; Description: Expected a parameter named 0
在以下位置:
@Query("" +
"MATCH (u:User)-[:LOCATION]-(l:Location)-[r]-(p:PostalCode) " +
"WHERE id(u)={0} " +
"RETURN l, r, p"
)
Location findUserLocation(long userId);
如果我为我的 java 编译器使用 -parameters
参数。
有谁知道,为什么它可能不起作用?
这是因为使用-parameters
编译允许框架从源代码中获取真实的参数名称。
换句话说,它的工作方式与:findUserLocation(@Param("userId") long userId)
将查询更改为使用 {userId}
而不是 {0}
应该可行。如果您需要兼容不同的编译选项,请使用 @Param
如上所述。
我使用 Spring Data Neo4j 4.2.0.RELEASE 并遇到以下异常:
org.neo4j.ogm.exception.CypherException: Error executing Cypher "Neo.ClientError.Statement.ParameterMissing"; Code: Neo.ClientError.Statement.ParameterMissing; Description: Expected a parameter named 0
在以下位置:
@Query("" +
"MATCH (u:User)-[:LOCATION]-(l:Location)-[r]-(p:PostalCode) " +
"WHERE id(u)={0} " +
"RETURN l, r, p"
)
Location findUserLocation(long userId);
如果我为我的 java 编译器使用 -parameters
参数。
有谁知道,为什么它可能不起作用?
这是因为使用-parameters
编译允许框架从源代码中获取真实的参数名称。
换句话说,它的工作方式与:findUserLocation(@Param("userId") long userId)
将查询更改为使用 {userId}
而不是 {0}
应该可行。如果您需要兼容不同的编译选项,请使用 @Param
如上所述。