How to get SELECT values and COUNT value with JPA GROUP BY?

Viewed 60017

If my entity is get as a Man, it have name, id properties, with JPA how I get retrieve result like this query,

entityManager.createQuery("SELECT m.name AS name, COUNT(m) AS total FROM Man AS m GROUP BY m.name ORDER BY m.name ASC");

Is there any way to use org.springframework.jdbc.core.RowMapper with JPA?

1 Answers
Related