title: exception in executing aggrigate query in spring-Hibernate example
body: <pre><code>   String SQL_QUERY ="select avg(RATING_NUMBER) From RatingModel where PRODUCT_FK='"+productId+"'";
         Query query = session.createQuery(SQL_QUERY);//&lt;--exception
          List list = query.list();
          System.out.println("Average" + list.get(0)); 
  </code></pre>
  
  <p><strong>Exception is</strong></p>
  
  <p>java.lang.NullPointerException
      at org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions$AvgFunction.determineJdbcTypeCode(StandardAnsiSqlAggregationFunctions.java:98)
      at org.hibernate.dialect.function.StandardAnsiSqlAggregationFunctions$AvgFunction.render(StandardAnsiSqlAggregationFunctions.java:92)
      at org.hibernate.hql.internal.ast.SqlGenerator.endFunctionTemplate(SqlGenerator.java:220)</p>
  
  <p><strong>I also do this</strong><br>
  but same exception occur</p>
  
  <p>double avg=((Double)         session.createQuery(SQL_QUERY ).uniqueResult()).doubleValue();</p>