title: spring crud repository find top n Items by field A and field B in list order by field C
body: <p>I have in a Spring Repo something like this:</p>
  
  <pre><code>findTop10ItemsByCategIdInOrderByInsertDateDesc(List ids)
  </code></pre>
  
  <p>I want the first 10 items where category id in list of ids ordered by insert date.</p>
  
  <p>Another similar query: </p>
  
  <pre><code>findTop10ItemsByDomainIdAndCategIdInOrderByInsertDateDesc(List ids, @Param Integer domainId)
  </code></pre>
  
  <p>Here I want that the domain id is equal to the given param and the categId to be in given list.</p>
  
  <p>I managed to resolve it using @Query but I wonder if there is an one liner for the above queries.</p>
  
  <p>thanks</p>
  
  <p><strong>EDIT</strong>
  The top works fine. Initially I had <code>findTop10ItemsByDomainIdAndCategIdOrderByInsertDateDesc</code>. Now I want the results from a list of category ids. That's the new requirement.</p>
  
  <p><strong>SECOND EDIT</strong>
  My query works for find the set o results where domain id is equal to a given param and categ id is contained in a given list. BUT I found out that HQL doesn't support a setMaxResult kind of thing as top or limit. </p>
  
  <pre><code>@Query("select i from Items i where i.domainId = :domainId and i.categId in :categoryIds order by i.insertDate desc")
  </code></pre>
  
  <p>The params for this method were <code>(@Param("domainid") Integer domainid,List&lt;Integer&gt; categoryIds)</code> but it seams that I'm alowed to use either @Param annotation to each parameter or no @Param at all ( except for Pageable return; not my case )</p>
  
  <p>I still don't know how to achieve this think:
  extract top n elements where field a eq to param, field b in set of param, ordered by another field.</p>
  
  <p>ps: sorry for tags but there is no spring-crudrepository :)</p>