当前位置: 代码迷 >> Web前端 >> hql中会合函数查询
  详细解决方案

hql中会合函数查询

热度:514   发布时间:2013-09-09 20:31:09.0
hql中聚合函数查询
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;
		}
	}

  相关解决方案