org.springframework.data.neo4j.annotation 包中的注解@Query 提供了某些计数属性,如countQuery、countQueryName。
/**
* @return simpler count-query to be executed for @{see Pageable}-support {self} will be provided by the node-id of the current entity other parameters (e.g. {name}) by the given named params
*/
String countQuery() default "";
/**
* @return name of the named count query to be used for this annotated method, instead of Class.method.count
*/
String countQueryName() default "";
有人可以解释一下这些的用法吗?更具体地说,我编写了一个查询来获取有关某个主题的帖子。查询结果将被分页。下面的查询工作正常,并给了我结果。
@Query("start post=node:__types__(className='com.xxx.entity.Post'), topic=node({0}) match post-[:TOPIC_POST]-topic return post")
Page<Post> getPostsByTopic(Topic topic, Pageable page);
现在我也想要结果总数,我是否必须为此编写另一个查询,或者有没有办法在其中容纳计数查询?