Hello,
Is there any way to select an absolute row number? This is a database feature required for searching when using pagination.
A practical example would be an end-user searching for a name that starts with 'J'. The application wants to know on which pages the records with 'J' exists, so it can jump to the page and provide options like search next and search previous.
In classic SQL, the queries would look like this:
Code:
SELECT t1.row_number
FROM (
SELECT name,
ROW_NUMBER() OVER (ORDER BY [CURRENT_ORDER]) AS row_number
FROM customers
WHERE ([CURRENT_FILTERS])
) t1
WHERE (t1.name like 'J%')
This query would provide the absolute row numbers of the records matching the search query. The application will be able to determine on which page the records are, and will be able to provide search previous and search next functionality.
Is there any way to achieve this using Hibernate (JPA CriteriaQueries)?