Description
Hi, guys, faced the same issue. Unfortunately, this "feature" totally breaks the pagination.
The problem is when I'm using 'groupBy' than a number of returned elements is much less than the totalElements and as a result totalPages is wrong too.
List<Long> totals = query.getResultList();
in my case totals looks like
col_0_0_
2
2
1
1
(4 rows)
So, the content will have only 4 elements.
But in the end, total will be 6
for (Long element : totals) { total += element == null ? 0 : element; }
Originally posted by @pkuzmenkov in #1034 (comment)
My specification is a little bit complicated, so I can't use distinct(true).
Generated query looks like this
select
count(presentati0_.id) as col_0_0_
from
presentation presentati0_
left outer join
presentation_label labels1_
on presentati0_.id=labels1_.presentation_id
left outer join
label label2_
on labels1_.label_id=label2_.id
left outer join
presentation_label labels3_
on presentati0_.id=labels3_.presentation_id
left outer join
label label4_
on labels3_.label_id=label4_.id cross
join
users user5_
where
presentati0_.user_id=user5_.id
and to_tsvector(coalesce(presentati0_.title, '')) || to_tsvector(coalesce(user5_.name, '')) || to_tsvector(coalesce(presentati0_.description, '')) || to_tsvector(coalesce(label4_.title, '')) || to_tsvector(coalesce(presentati0_.speaker_name, '')) @@ to_tsquery(?)=true
group by
presentati0_.id ,
user5_.name