日期:2014-05-20 浏览次数:20814 次
service.getPageModelForSql("select em.name ,pc.date,dept.name as dname,p.name as pname ,pc.postNum " + "from t_postcount pc ,t_post p ,t_employees em ,t_department dept " + "where pc.post = p.id and pc.epid = em.id and p.pid = dept.id " + "and em.id = "+employeesId+" order by dept.id,pc.date desc ", offset, pageSize);
Query query = this.getSession().createSQLQuery(sql); //sql就是以上sql语句
List list = query.list(); for (int i=0;i<query.list().size();i++){ Object[] o = (Object[]) query.list().get(i); System.out.println((String)o[0]+"==="+(Date)o[1]+"==="+(String)o[2]+"==="+(String)o[3]+"==="+Integer.parseInt(o[4].toString())); }