I need to write a query that would return users ordered by creation date. The query has to accept offset
and count
, so I need to get all rows starting from the offset
ending with offset + count
. I can easily write a corresponding SQL query, but I am not able to convert it to HQL.
To be more clear, the corresponding SQL would look like this:
SELECT * FROM users
ORDER BY created_at
OFFSET 20 ROWS
FETCH FIRST 10 ROW ONLY;
Q: How can I implement the same in HQL (JP-QL)?
I am using Hibernate together with Quarkus and Panache.