title: ClassCastException when using HQL
body: <p>See the following mapping</p>
  
  <pre><code>public class SomeClass {
  
      private Integer someField;
  
  }
  </code></pre>
  
  <p>When i call the following query</p>
  
  <pre><code>select someField, count(*) from SomeClass inner join OtherClass... group by ...
  </code></pre>
  
  <p>And i proccess the query as follows</p>
  
  <pre><code>Map&lt;Integer, Integer&gt; result = new HashMap&lt;Integer, Integer&gt;();
  
  List&lt;Object&gt; objectList = query.list();
  for(Object object: objectList) {
      Object [] objectArray = (Object []) object;
  
      result.put((Integer) objectArray[0], (Integer) objectArray[1]);
  }
  </code></pre>
  
  <p>I get ClassCastException: can not convert Long to Integer</p>
  
  <p>Question: what should i do to retrieve the values returned by the HQL as Integer instead of Long ????</p>