I'm trying to fetch the last 20 entities from Hibernate using the Criteria class. If I call something like this:
Code:
Criteria criteria = session.createCriteria(MyEntity.class);
criteria.setMaxResults(20);
I'll get 20 results back, but the results will start from the beginning of the table, rather than the end of the table. How do I reverse this? I've looked into criteria.addOrder(), but it seems that utilizing that will just format the entities before I get them by calling criteria.list();
What should I do?[/code]