取得Hibernate返回对象的列值

String hql="select DISTINCT compCat ,COUNT(*),compStatus from CompInfo “ Query query=this.getSession().createQuery(hql); for(int i=0;i<query.list().size();i++){ Object[] obj = (Object[])query.list().get(i); cac.setCompTempCat(obj[0].toString()); cac.setCompCount(Integer.parseInt(obj[1].toString())); cac.setCompTempStatus(obj[2].toString()); list.add(cac); }

 

 

   

     

你可能感兴趣的:(Hibernate,object,String,query)