I'm seeing some weird issue while working with findAll() method with the specification and pageable arguments. If I set the lower page i.e. 0 size i.e. 10 then I don't have any issues. but if I set the page i.e. 0 and size to 30 I'm getting the duplicate records.

e.g. | ID | NAME | | -------- | -------------- | |1|test| |2|test| |3|test| |4|test| |5|test| |6|test| |7|test| |8|test| |9|test| |1|test| |2|test| |3|test| |4|test| |11|test| |6|test| |7|test| |18|test|

I have the following in the database. | ID | NAME | | -------- | -------------- | |1|test| |2|test| |3|test| |4|test| |5|test| |6|test| |7|test| |8|test| |9|test| |10|test| |11|test| |12|test| |13|test| |14|test| |15|test| |16|test| |17|test| |18|test|

@Entity
@Table(name = "table_name")
@JsonIgnoreProperties(ignoreUnknown = true)
@DynamicUpdate
public class Emp implements Persistable<String> {
    @Id
    @Column(name = "emp_id", nullable = false, columnDefinition = "BINARY(16)")
    public String empId;

    @Column(name = "name");
    public String name;
    // other fields

    //setters and getters
}
@Repository
public interface EmpRepository extends JpaRepository<Emp, String> {
    Page<Emp> findAll(Specification<Emp> specification, Pageable page);
}
public class EmpSpecification {
    public static Specification<Emp> nameEquals(String name) {
        return (root, query, builder) -> name == null ? null : builder.equal("name", name);
    }
}

in the service class we are trying to fetch data using the following code:

Specification<Emp> specifications = Specification.where(EmpSpecification.nameEquals(name)));
details = consolidatedTradeSummaryRepository.findAll(specifications, page);

http://localhost:8080/emp?name=test&page=0&size=10 http://localhost:8080/emp?name=test&page=0&size=20

Spring boot version : 2.2.2.RELEASE

Comment From: snicoll

@nagraj321 thank you for the report but there isn't anything we can do about this here. As mentioned in the guidelines for contributing, we prefer to use GitHub issues only for bugs and enhancements so please ask that question on StackOverflow.

If you think you've found a bug, that should be reported against Spring Data. When you do so, please attach a small sample that the team can run rather than all this code in text. Thank you.