How do I do a distinct counting with Spring Data JPA? I do not want to use the @Query
annotation. The equivalent sql query would be:
SELECT COUNT(DISTINCT rack) FROM store WHERE id = 10001;
I tried by writing the following query, but it isn't working:
int countDistinctRackById();
This should work :
Integer countDistinctRackById(Long id);