Finding out the page containing a given record using JPA (Hibernate)
How can I know the position of a record in a JPA query? I have a service that returns paged results implementing more or less a method with this signature: List<Record> getRecordsPage(long page, int pageSize); When this is invoked I just create a query and configure like this: TypedQuery<Record> query = entityManager.createQuery(criteriaQuery); query.setFirstResult(page * pageSize); query.setMaxResults(pageSize); This pages the result. And this is working as expected, and is quite simple. The Problem Another requirement I have is to implement a method that would retrieve the page that contains