为什么一个注释中有两个查询?

时间:2018-02-19 05:03:48

标签: spring-boot neo4j

以下是Spring Data和Neo4j文档中的示例,该文档演示了cypher查询的用法。

// returns a Page of Actors that have a ACTS_IN relationship to the movie node with the title equal to movieTitle parameter.
    @Query(value = "MATCH (movie:Movie {title={0}})<-[:ACTS_IN]-(actor) RETURN actor", countQuery= "MATCH (movie:Movie {title={0}})<-[:ACTS_IN]-(actor) RETURN count(actor)")
    Page<Actor> getActorsThatActInMovieFromTitle(String movieTitle, PageRequest page);

使用第二个查询&#34; countQuery = ...&#34;?它在此查询中是否起任何作用?

1 个答案:

答案 0 :(得分:0)

文档here中提到了该用法。相关部分:

  

如果要求分页结果返回正确的总计数,   @Query注释可以在中提供计数查询   countQuery属性。此查询在单独执行后执行   结果查询及其结果用于填充元素的数量   在页面上。

相关问题