public List xiaoa(){
String hql = "select count(*),sum(hu.salarySum),hu.configFileFirstKind.firstKindName,hu.configFileSecondKind.secondKindName from HumanFile hu" +
" group by hu.configFileFirstKind.firstKindName,hu.configFileSecondKind.secondKindName";
return super.getHibernateTemplate().find(hql);
}
以为返回的是一个List,遍历的时候size()正确,但值不能正确显示
实际上返回的是一个Object[]的数组。所以就简单多了
List<Object []> list = biz.xiaoa();
for (int i = 0; i < list.size(); i++) {
List<Object []> li = new ArrayList();
li.add(list.get(i));
for (Object[] o : li) {
System.out.println("总人数"+o[0]+"\t 薪酬总额"+o[1]+
"\t 一级机构"+o[2]+"\t 二级机构"+o[3]);
}
}