title: How to get an integer value using hibernate createSQLQuery?
body: <p>I need to fetch the result of the following query but i am getting a typecast exception. Kindly help out!</p>
  
  <pre><code>SELECT COUNT(*) FROM ( SELECT DISTINCT a.PROPSTAT_CODE,a.PROPSTAT_DESC,a.PROPSTAT_TYPE FROM CNFGTR_PROPSTAT_MSTR a WHERE 1 = 1 )
  </code></pre>
  
  <p>My code is given below,</p>
  
  <pre><code>Query query = session.createSQLQuery(sqlQuery);  
  
  listRes = query.list();
  
  int ans = ((Integer)listRes.get(0)).intValue();
  </code></pre>
  
  <p>Thanks in advance</p>