How do you order a resultset without causing OutOfMemory exceptions?
In my case I just want to have 20 results within a paged resultset....
Code:
public List<User> getLatestMembers() {
Criteria criteria = _session.createCriteria(User.class);
criteria.setMaxResults(20);
List<User> users = criteria.list();
return users;
}
works fine....but once I want to order the users by the registration date I get this OutOfMemory exception:
Code:
public List<User> getLatestMembers() {
Criteria criteria = _session.createCriteria(User.class);
criteria.addOrder(Order.desc("lasttime"));
criteria.setMaxResults(20);
List<User> users = criteria.list();
return users;
}