title: How to distinct counting with Spring JPA Repository
body: <p>How do I do a distinct counting with Spring Data JPA? I do not want to use the <code>@Query</code> annotation. The equivalent sql query would be: </p>
  
  <pre><code>SELECT COUNT(DISTINCT rack) FROM store WHERE id = 10001;
  </code></pre>
  
  <p>I tried by writing the following query, but it isn't working:</p>
  
  <pre><code>int countDistinctRackById();
  </code></pre>