Skip to content

Documentation Improvement: countQuery #2831

@nightswimmings

Description

@nightswimmings

By reading https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.at-query.native, I realised there are few important aspects that I think it would be interesting to extend:

1.On native queries part, it is not clear what dynamic sorting means in this context (passing a Sort, Pageable)?
2.The following paragraph it says that Pageable is supported, I think it is not clear whether it applies to the Sort part in it?
3.Then it says the countQuery is needed, but Ive seen examples with native queries and countQuery not being needed, so I guess there must be some counterpart.
4. Besides, non-native @queries are not mentioned, does that mean that countQuery is completely useless on those? How does JPA perform the magic counting? By issuing the whole query and counting the results? Or by rewriting it as SELECT count(*) internally? If its the former, I believe there should be a note stating that even JPA can infer the totals, it's always advised to provide the query yourself for performance

Thanks guys! Your project is amazing

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions