- 论坛徽章:
- 0
|
程序需要进行数据统计,hql里用到了count函数,会产生别名。控制台能够打印出查询结果,传到action,集合类变量也能打印出结果,都正确。但是到jsp页面就显示不出来了。
Hibernate: select top 10 tconferenc0_.conferencecountry as col_0_0_, count(tconferenc0_.conferencecountry) as col_1_0_ from meeting.dbo.T_conference tconferenc0_ where tconferenc0_.conferencecountry is not null group by tconferenc0_.conferencecountry order by count(tconferenc0_.conferencecountry) desc
Query query = session.createQuery("select " + queryName + ", count(" + queryName + ") as confcount from " + entityname + " where " + queryName + " is not null group by " + group + " order by " + order + " " + sort);
经过比较,发现我自己写的count的别名是confcount 但是hql自定义了as col_1_0_
怀疑问题出在这里,但是不知道该怎么修改。 |
|