首页 > 技术文章 > hql得到一个实体的数量

toSeeMyDream 2015-04-20 20:53 原文

Session session=this.getSession;
string hql="select count(tb) from table tb";
Query query=session.createQuery(hql);
int count=(Integer)query.uniqueResult();

推荐阅读