I had an application returning about 12,000 results, which tended to
cause displaytag to implode. I solved it by creating the following
method, using a Hibernate Criteria query:

    public Collection getPartialHardwareList(final int start, final int
listSize) {

        return (Collection) getHibernateTemplate().execute(new
HibernateCallback() {
            public Object doInHibernate(Session session) throws
HibernateException, SQLException {

                Criteria criteria =
session.createCriteria(Hardware.class);
                criteria.addOrder(Order.asc("name"));
                criteria.setFirstResult(start*listSize);
                criteria.setMaxResults(listSize);
                return criteria.list();
            }
        });

    }

In case it doesn't make sense, this is using the Spring/Hibernate
integration. If you are not using Spring, ignore the "doInHibernate"
part and just concentrate on the 5 lines in the method.

I begged on the list for someone to show me an implementation of the
PaginatedList interface, but was ignored...

Jason 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Paul
Cooper
Sent: Monday, August 06, 2007 3:29 PM
To: displaytag-user@lists.sourceforge.net
Subject: [displaytag-user] External paging and sorting, and exporting

I've asked this before but got no response, so I thought I'd try
again....

I've implemented external paging, since I'm using Hibernate, and my
object result set can get pretty large. I'm having trouble implementing
two aspects: external sorting and external exporting. The sorting works
in one direction, but when I select a column for sorting a second time,
it sorts the same way it was. I see support for a "dir" parameter, but
I'm not sure how to implement it.

Also, I see no support for external exporting. Is anyone doing this, and
if so, how?

Paul Cooper

Project Manager

 

The EMS Performance Improvement Center

100 Market Street

Chapel Hill, NC  27516

(919) 843-0201 ext. 246 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to