java,php,asp.net,linux,javascript,mysql,mssql,oracle,编程

用Hibernate实现分页

转载请注明:http://www.pmjava.com/Article/ShowInfo.asp?ID=56585
public List queryByStatus(int status, int currentPage, int lineSize)
           
throws Exception {
        List all
= null;
        String hql
= "FROM Question AS q WHERE q.status=? ORDER BY q.questiontime desc";
        Query q
= super.getSession().createQuery(hql);
        q.setInteger(
0, status);
        q.setFirstResult((currentPage
- 1) * lineSize);
        q.setMaxResults(lineSize);
        all
= q.list();
       
return all;
    }

posted on 2009-06-10 21:26 rrong_m 阅读(44) 评论(0)  编辑  收藏

<2024年5月>
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678

导航

统计

常用链接

随笔档案

文章分类

文章档案

java编程

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜