manager查询_分页
2015-11-16 00:00
155 查看
摘要: hibernate分页
public List<Object[]> findExportList(String where) { String sql=" select A.APPLICATION_USER_ID,'采购',A.TOOL_NAME,A.LAST_PRICE, " + "A.TOOL_NAME||'用途:'||A.USE_DECRIPTION ,'总计'" + " FROM B_BUY_APPLICATION A LEFT JOIN " + " B_BUY_APPLICATION_CHECK B ON A.OBJECT_ID = B.BUY_APPLICATION_ID "; try { String countSql = "SELECT COUNT(*) FROM (" + sql + where + ")"; SQLQuery countQuery = getSession().createSQLQuery(countSql); List count = countQuery.list(); int total = ((Number) count.iterator().next()).intValue(); //分页查询 SQLQuery query = getSession().createSQLQuery(sql + where); //设置返回初始位置 query.setFirstResult(0); //设置返回最大位置 query.setMaxResults(total); List<Object[]> list = query.list(); return list; } catch (HibernateException e) { } return null; }
相关文章推荐
- hibernate查询_函数
- MySql error while loading shared libraries: libai
- Python语言精要
- 如何运用好MindMapper局部中心功能
- 在报表开发平台中集成第三方图表库
- 发送超长短信的协议格式
- 五分钟理解一致性哈希算法(consistent hashing)
- HTTP Cookie学习
- HOTPOWER.【专注游戏界面外包】/接游戏界面外包/logo外包/icon
- ZBrush®中Alt键和Shift键
- 蜂窝教育iOS培训:如何选择教学水平高机构
- C语言获取网页源代码
- MySQL磁盘复制技术--DRBD:优缺点比较、注意事项以及最佳实践
- github简单使用
- user-agent解析工具
- python url解码
- spring aop execution表达式说明
- excel名称管理器的导入
- excel复选框的实现
- linux服务器配置ssh互信(RSA)