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..