-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: hibernate paging problem
PostPosted: Fri Jul 10, 2009 3:40 pm 
Newbie

Joined: Wed Oct 08, 2008 3:06 pm
Posts: 13
Location: Seattle
I tried to page the results and it only worked for the first few pages (click next, next ,next...). Then hibernate stops functioning (hibernate won't return any data at all) and I have to restart the server (tomcat) to let it work again.. I use extjs at the frontend to handle paging so I need to return both the paged data and total number of data from the table.

Code:
   
public Map getLimitedRecords(int start, int limit) {
        System.out.println("before query...");
        String hql = "from Test";
        Map data = new HashMap();
        Query query = this.getSession().createQuery(hql);

        System.out.println("query run...");
        data.put("count", query.list().size()); <= program stops here after about 5 runs..
        data.put("data", query.setFirstResult(start).setMaxResults(limit).list());
        return data;
    }


any ideas?

Thanks..


Top
 Profile  
 
 Post subject: Re: hibernate paging problem
PostPosted: Sat Jul 11, 2009 11:03 pm 
Senior
Senior

Joined: Wed Sep 19, 2007 9:31 pm
Posts: 191
Location: Khuntien (Indonesia)
Can you post your log? So everybody can help you.

chuguanyu wrote:
I tried to page the results and it only worked for the first few pages (click next, next ,next...). Then hibernate stops functioning (hibernate won't return any data at all) and I have to restart the server (tomcat) to let it work again.. I use extjs at the frontend to handle paging so I need to return both the paged data and total number of data from the table.

Code:
   
public Map getLimitedRecords(int start, int limit) {
        System.out.println("before query...");
        String hql = "from Test";
        Map data = new HashMap();
        Query query = this.getSession().createQuery(hql);

        System.out.println("query run...");
        data.put("count", query.list().size()); <= program stops here after about 5 runs..
        data.put("data", query.setFirstResult(start).setMaxResults(limit).list());
        return data;
    }


any ideas?

Thanks..


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.