Closed
Description
Alex opened DATAJPA-342 and commented
If I define a custom query of this type:
@Query("SELECT DISTINCT m.genre FROM Media m WHERE m.user = ?1 ORDER BY m.genre ASC")
Page<String> getJukeGenres(User user, Pageable pageable);
The resulting Page element has wrong Total Elements.
It seems like it gives the number of total records instead of the distinct ones.
I had to create another adhoc query just to have the correct count:
@Query("SELECT count(*) as num FROM Media m WHERE m.user = ?1 AND m.genre IS NOT NULL")
long countGenres(User user);
But this is tedious workaround that I would like to avoid
Affects: 1.3 GA