title: JPA, Entity manager, select many columns and get result list custom objects
body: <p>How I can get list of custom objects, like results below query:</p>
  
  <pre><code>SELECT p.category.id, count(p.id) FROM Product p left join p.category c WHERE p.seller.id=:id GROUP BY c.id
  </code></pre>
  
  <p>By example:</p>
  
  <pre><code>return getEntityManager().createQuery("SELECT p.category.id, count(p.id) FROM Product p left join p.category c WHERE p.seller.id=:id GROUP BY c.id").setParameter("id", id).getResultList();
  </code></pre>
  
  <p>I need a map with category id and number of products in category.</p>