title: Is it possible to use COUNT with a DISTINCT JPA projection?
body: <p>I am using a JPA distinct projection to get some data:</p>
  
  <pre><code>select distinct o.f1, o.f2, o.f3 from SomeEntity o where ...
  </code></pre>
  
  <p>This works fine with setFirstResult and setMaxResults to page data.</p>
  
  <p>However I need to count the total number of rows without fetching all of them. I have tried:</p>
  
  <pre><code>select count(distinct o.f1, o.f2, o.f3) from SomeEntity o where ...
  </code></pre>
  
  <p>This does not work (with EclipseLink anyway) and it doesn't seem to be allowed by the JPA spec. Is there another way? I don't want to have to write an SQL query to do this.</p>