【发布时间】:2016-04-19 15:43:08
【问题描述】:
请帮忙解决这个问题:
@Query("MATCH (n:User{userId:1})--(friends) return friends order by {type}")
Iterable<Map<String, Object>> getLastFriendsByLevel(@Param("userId") long userId, @Param("type") String type);
type = "friends.level" 时,结果未按预期按级别排序。当参数“type”包含'.'时,似乎排序不起作用。
怎么了?
【问题讨论】:
-
您不能参数化节点或关系属性键,您必须在查询本身中写入
friends.level -
谢谢。 @Query("MATCH (n:User{userId:1})--(friends) 按好友顺序返回好友顺序。{type}") Iterable> getLastFriendsByLevel(@Param("userId") long userId, @Param( "type") 字符串类型) 也不起作用,当 type="level" 时?或者,有没有其他方法可以在 ordering 子句中传递参数?
-
您的问题在当前状态下很难理解。请查看how to create a minimal, complete, and verifiable example 并编辑您的问题。
-
@DmitryRomov 您仍在尝试参数化属性键 ;-) friends 是节点,而 {type} 是属性键,这是不可能的,并且 Cypher 语言不支持。跨度>
-
是的,我刚刚知道了)。谢谢,克里斯托夫。祝你有美好的一天!
标签: neo4j spring-data