title: JPA count query with maximum results
body: <p>Can you please share me code snippet to be written via JPA in order to generate the below sql query</p>
  
  <pre><code>SELECT COUNT(*) FROM Customer c 
  WHERE c.countryId ='Canada' AND 
        c.lanuguage ='ENG' AND 
        ROW_NUM &lt;=10;
  </code></pre>
  
  <p>Because I tried in the below way. But MaxResults is not getting applied it seems as I can able to recieve the count more than 10.</p>
  
  <pre><code>Query query = em.createQuery("SELECT COUNT(c) FROM Customer c where c.countryId ='Canada' and c.lanuguage ='ENG'");
  query.setMaxResults(10);
  long customerCount = (Long)query.getSingleResult();
  </code></pre>