title: How to select multiple columns using sum projection with group by in Hibernate
body: <p>My MySQL query is:</p>
  
  <pre><code>SELECT 
      c.first_name, 
      c.middle_name, 
      c.last_name, 
      s.ticker, 
      COUNT(s.ticker), 
      SUM(t.cumulative_qty), 
      SUM(cumulative_balance)
  FROM client_master c, security s, transaction_master t 
  WHERE c.id = t. client_master_id AND s.id = t.security_id AND t.client_master_id = 4 
  GROUP BY t.security_id;
  </code></pre>
  
  <p>This query returns an exact result. I want to write Hibernate Criteria that has a matching result. This is what I tried:</p>
  
  <pre><code>Criteria criteria = createEntityCriteria(TransactionDetails.class, "tr")
                  .createAlias("tr.client", "cl")
                  .createAlias("tr.security", "se")
                  .add(Restrictions.eq("cl.id", clientId))
                  .setProjection(Projections.sum("tr.cumulativeQty"))
                  .setProjection(Projections.groupProperty("tr.securityId"));
  
  return  criteria.list();
  </code></pre>
  
  <p>But this Criteria is returning just a <code>List</code> of <code>tr.securityId</code>. I want all the rows. Where am I going wrong?</p>