spring-projects / spring-projects/spring-data-jpa

count method in JpaSpecificationExecutor ignores GROUP BY and returns wrong result. [DATAJPA-1573]

Open
#1,858 3 comments 0 reactions 1 assignee View on GitHub

@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:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.