title: How to retrieve only certain fields of an entity in JPQL or HQL? What is the equivalent of ResultSet in JPQL or HQL?
body: <p>In JPQL, I can retrieve entities by :</p>
  
  <pre><code>query = entityManager.createQuery("select c from Category c");
  List&lt;Category&gt; categories = query.getResultList();
  </code></pre>
  
  <p>But, if I wish to retrieve the id and name fields (only) of the Category entity, I need something like the <code>ResultSet</code> object, through which I can say : <code>rs.getString("name")</code> and <code>rs.getString("id")</code>. How to do this through <code>JPQL</code>, without retrieving the entire entity ?</p>
  
  <p>Basically, for a how to retrieve information from a query like : <code>select c.id,c.name from Category c</code> ?</p>