HQL - row identifier for pagination

Posted by anna.ruk on Stack Overflow See other posts from Stack Overflow or by anna.ruk
Published on 2009-01-28T21:04:16Z Indexed on 2010/06/15 23:12 UTC
Read the original article Hit count: 236

Filed under:
|

Does anyone know if HQL has a keyword to identify rows such as ROWID or ROWNUM?

I would like to implement pagination with HQL but I am not able to use .setMaxResult() or .setFirstResult() because I don't work with the session object directly and therefore don't use the Query object but simply create my query as a string and use the .find() method.

I tried using LIMIT and OFFSET in my query, but HQL seems to be ignoring these keywords and is returning the whole result to me no matter what.

I'm also not able to use Hibernate criteria because it does not have support for the "HAVING" clause that appears in my query.

My last resort is to restrict the result set using the ROWNUM/ROWID keyword. Does anyone else have any other suggestions?

© Stack Overflow or respective owner

Related posts about pagination

Related posts about hql