title: TypedQuery instead of normal Query in JPA
body: <p>Is it possible to write this Query as a TypedQuery and let the two Long's run into a Object with two public Long fields inside.</p>
  
  <pre><code>    Query q = em.createQuery(
              "SELECT c.id, COUNT(t.id) " +
              "FROM PubText t " +
              "JOIN t.comm c " +
              "WHERE c.element = ?1 " +
              "GROUP BY c.id");
      q.setParameter(1, e);
      List&lt;?&gt; rl = q.getResultList();
      Iterator&lt;?&gt; it = rl.iterator();
      HashMap&lt;Long, Long&gt; res = new HashMap&lt;Long, Long&gt;();
      while (it.hasNext()) {
          Object[] n = (Object[]) it.next();
          res.put((Long)n[0], (Long)n[1]);
      }
      return res;
  </code></pre>