spring-projects / spring-projects/spring-data-jpa
count method in JpaSpecificationExecutor ignores GROUP BY and returns wrong result. [DATAJPA-1573]
Open
@schauder is already working on this.
Since Dec 30, 2020.
in: querydsl
type: bug
- Dominant language
- Java
- Stars
- 3.3k
- Forks
- 1.6k
- PR merge metrics
- No merged PRs in 30d
Description
Dimitri opened DATAJPA-1573 and commented
I have this code:
public Predicate toPredicate(Root<User> root, CriteriaQuery<?> query, CriteriaBuilder builder){
...
query.groupBy(root.get("id"));
...
}
Method
Repository.count(specification)
ignores GROUP BY and returns wrong result, while
Repository.findAll(specification).size()
returns right result.
This issue looks similiar to this problem: https://jira.spring.io/browse/DATAJPA-656
Affects: 2.1.9 (Lovelace SR9)
Attachments:
- datajpa-1573.zip (89.10 kB)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.