现在的位置: 首页 > 综合 > 正文

hql中聚合函数查询

2013年10月21日 ⁄ 综合 ⁄ 共 336字 ⁄ 字号 评论关闭
public int find2(String hql){
		final String hql1 = hql;
		 try{
			this.getHibernateTemplate().execute(new HibernateCallback(){
				//执行查询操作
				public Object doInHibernate(Session session)
						throws HibernateException, SQLException {
					list = session.createQuery(hql1).list();
					return list;
				}				
			});			
			int num=(Integer) list.get(0);
			return num;
		}catch(Exception e){
			e.printStackTrace();
			return  0;
		}
	}

【上篇】
【下篇】

抱歉!评论已关闭.