hibernate如何获取总记录数


Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
int num = 0;
Long count = null;
StringBuffer queryTemp=new StringBuffer();
queryTemp.append("SELECT COUNT(*)FROM Salesrecords AS a");       
queryTemp.append(" ORDER BY a.id DESC");
count = (Long)getHibernateTemplate().find(queryTemp.toString()).listIterator().next(); 
      ##上边返回的是Long,而不是Integer
 num = count.intValue();