hibernate分页

@SuppressWarnings("unchecked") public List findAppPackageAndTerminal(String sql, int rangeStart, int fetchSize) { List list = this.getSession().createSQLQuery(sql).setFirstResult(rangeStart).setMaxResults(fetchSize).list(); List<AppPackage> sumlist = new ArrayList<AppPackage>(); Object []o = null; for(int i = 0; i < list.size(); i++) { AppPackage app = new AppPackage(); o = (Object[]) list.get(i); //终端型号名称 app.setPackageMd5((String)o[0]); //终端型号代码 app.setPackageStatus((String)o[1]); //软件包文件类型 app.setInstallFlag((String)o[2]); //软件包文件名 app.setFileName((String)o[3]); app.setStorePath((String)o[4]); sumlist.add(app); } return sumlist; }

你可能感兴趣的:(sql,Hibernate,object,list,String,终端)