I'm stuck in get the total count of group by query result.
JPAQuery jpaQuery = new JPAQuery(entityManager);
jpaQuery.from(QMessageSend.messageSend)
.where(predicate)
.groupBy(QMessageSend.messageSend.messageId).count();
this is my current code.
and this code return count for each group.
SELECT count(*)
FROM MESSAGE_SEND ms
GROUP BY ms.MESSAGE_ID
but I want to get the total count of group by query result. like result of below sql
SELECT count(*)
FROM (
SELECT *
FROM MESSAGE_SEND ms
GROUP BY ms.MESSAGE_ID
) msc
What I should do?
MESSAGE_ID is not primary key. and JPAQuery's distinct method not support select specific column. (has no parameter)