title: Return a subset of a JPA entity as a array of maps from a JPQL query?
body: <p>In JPQL it is possible to ask for a subset of an entity using a constructor expression such as </p>
  
  <pre><code>SELECT NEW example.EmployeeDetails(e.name, e.salary, e.department.name) FROM Employee e
  </code></pre>
  
  <p>which returns a list of objects of type EmployeeDetails</p>
  
  <p>or using a projection select such as </p>
  
  <pre><code>SELECT e.name, e.salary FROM Employee e
  </code></pre>
  
  <p>which returns an <code>Object[] result</code> where result[0] is e.name and result[1] is e.salary </p>
  
  <p>is there a way to get JPA to return a Map which contains a subset of the entity for example is there a JPQL query that can return  <code>List&lt;Map&lt;String,Object&gt;&gt; result</code> such that <code>result.get(0).get("e.name")</code> return <code>e.name</code> and <code>result.get(0).get('e.salary')</code> return <code>e.salary</code></p>
  
  <p>If JPQL can't do it does can HQL do it?</p>