Discussions

General J2EE: paging with hibernate

  1. paging with hibernate (3 messages)

    please recommand some good way to do the paging.to retrieve a big list from database is vary slow. what's the best way to return only reqired subset of list for every page.I don't want to do this in database tier since I don't want to introduce column for identify the rows for page such as rownumber.
    I know in Oracle there is rownum, but this is a vendor specified feature.
    is there any other generic way to do this?
    if I'm using HQL with hibernate, is there any way to handler it?

    Threaded Messages (3)

  2. paging with hibernate[ Go to top ]

    I was having s similar requirements for implemeting Paging, column based sorting etc in a struts application and I came across this - http://displaytag.sourceforge.net/

    You may try this, its extremely easy to use and is a big help in providing pagination in JSP's.

    Cheers,
    Vijay
  3. Try this:[ Go to top ]

    query=session.createQuery(hsql);
    int start=(pageNog-1)*page_size;
    int rowNum=page_size;
    query.setFirstResult(start);
    query.setMaxResults(rowNum);
    offices = query.list()
  4. Try this:[ Go to top ]

    Thank you.
    I think using this way, the habernate still need to retrieve database for all result set and convert part of result set into list.
    what I like is to reitrieve only part of result from database to save retrieveing time since we have very big result set

    thank you