Closed zdu-strong closed 1 year ago
I’m not sure what you mean by total count. If you want the count of the elements of each group, you can just follow the example here:
http://www.jinq.org/docs/queries.html#N67306
Counts of other things—like the number of groups or counts of elements across all the groups—those can’t be represented in SQL, so there is no way to do that without issuing a separate query or grabbing the data and then manually querying the result.
Share my pagination experience when using Jinq and mysql database.
The following is the usage, pagination processing inside the PaginationModel, even the stream of group by is OK.
If someone wants to refer to the source code, please check my project (https://github.com/zdu-strong/Technical_Backup/tree/master/springboot).
When there is no group by, I directly call .count() to get the total number of entries.
After the group by, I call .count(), which throws an exception: java.lang.IllegalArgumentException: Could not translate code to a query.
How to get the total count after group by?