Pageable not giving expected results with @ManyToMany relationship [DATAJPA-1760] #2053
Labels
in: core
Issues in core support
status: declined
A suggestion or change that we don't feel we should currently apply
type: bug
A general bug
Manoj Kumar opened DATAJPA-1760 and commented
When we are dealing with
@ManyToMany
relation with Users and Roles and want to have pagination to get all the Users with associated Roles by using Pageable interface. It is only considering the records count for pagination on the User Table and Roles table record is not considered. But ideally in RDBMS the actual record count would be after flattening the result of join between Users and Roles table.For Example:
Users Table
Role Table
UserRole Table
Result of Join between User and Roles Table
When working with Pageable in findAll method and passing the page configuration as below :
pageno: 0 and pageSize:1
It is giving the result as below
!image-2020-07-23-12-55-16-479.png!
Here Technically there are 3 records when we flatten the result but pageable is considering this as 1 record which is not correct . kindly suggest if this is intended behavior, if yes then
does there is any way where we can get the pagination after flattening the result set of query.
Attachments:
The text was updated successfully, but these errors were encountered: