I need to get at the records in the middle of a table, but the table is too large to load the entire thing into memory. In SQL this could be accomplished (admittedly somewhat inefficiently) like this:
select top 10 (*) from post where id not in(SELECT top 10 id from post order by postdate) order by postdate
This would select records 11 through 21. Unfortunately, this can't be translated into hql because hql doesn't support the top statement.
I've been using HibernateTemplate and HQL in the rest of my code, so I'd prefer to continue doing things that way.
Any ideas?
|