I just updated my application to use Hibernate 2. Everything works just fine except ONE query, which is as follows:
Code:
Query q = session.createQuery("from a in class A where a.name=? order by a.created desc");
q.setString(0, myName);
q.setFirstResult((pageNum - 1) * pageSize);
q.setMaxResults(pageSize);
myList = q.list();
If pageNum is 1 (ie. firstResult is set to 0) the query returns the rows just fine, but when the pageNum is > 0, it returns an empty list.
And I know there ARE rows it should return, because if I set maxResults to eg. 100 the query returns all the rows (currently 22 in the DB), but with anything less that 22 (and firstResult > 0), the query returns an empty list.
The query worked OK with Hibernate 1, I have made no changes to the query. The DB I use for this application is Oracle.
Thanks!