Spring 页面查询
来源:互联网 发布:excel数据分类统计分析 编辑:程序博客网 时间:2024/05/16 19:29
/**
* TOP查询
* @param sql String
* @param top int
* @return List
*/
public List findTop(String sql, int top) {
HibernateTemplate ht = this .getHibernateTemplate();
ht.setMaxResults(top);
return ht.find(sql);
}
/**
* 分页查询
* @param sql String
* @param firstRow int
* @param maxRow int
* @return List
*/
public List findPage( final String sql, final int firstRow, final int maxRow) {
return this .getHibernateTemplate().executeFind( new HibernateCallback(){
public Object doInHibernate(Session session) throws SQLException,
HibernateException {
Query q = session.createQuery(sql);
q.setFirstResult(firstRow);
q.setMaxResults(maxRow);
return q.list();
}
});
}
模板实现分页:
public List find( final String hsql, final int firstRow, final int maxRow) throws Exception {
return getHibernateTemplate().executeFind( new HibernateCallback() {
public Object doInHibernate(Session s) throws HibernateException, SQLException {
Query query = s.createQuery(hsql);
query.setFirstResult(firstRow);
query.setMaxResults(maxRow);
List list = query.list();
return list;
}
});
}
- Spring 页面查询
- Spring mvc 联合查询+分页+条件搜索+页面局部刷新
- spring 模糊查询,查询
- Spring 使用配置完成从前台页面输入到查询数据库的例子
- 查询页面 (Search)
- Silverlight 查询目录页面
- php页面查询
- 查询栏页面代码
- 域名查询 html页面
- 域名查询 php页面
- java页面模糊查询
- 分页条件查询页面
- HTML5-查询页面
- 动态显示页面+查询
- java页面动态查询
- 查询条件提交页面
- Servlet页面访问量查询
- spring mvc 页面跳转
- 使用dbx调试java程序
- 远程桌面同时登陆人数问题
- T400 ubuntu10.04 无线网卡不能使用的问题
- sql server 数据库题目
- Windows mobile 下读取手机SIM卡信息
- Spring 页面查询
- ssh access control:
- windows mobile 5.0 进程管理、窗体管理、重启和关闭操作系统
- 我的博客
- php读取xml中文乱码解决方法
- 网站标题优化
- 什么是SLA和PUE
- 操作系统 进程调度 基于时间片轮转(C实现 Visual Stdio 2005)
- 关于高性能服务器的一些站点资源