The annotation @Query in package org.springframework.data.neo4j.annotation provides certain count attributes like 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 "";
Can somebody please explain the usage of these? To be more specific I've written a query to fetch the posts on a topic. The query results will be paginated. The query below works fine and gives me the result.
@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);
Now I also want the total number of results as well, do I have to write another query for this or is there a way to accommodate count query in this?