Pagination with Hibernate. Set Long as 'offset'.


#1

Is there a way to make pagination with Hibernate when data count could be more then max Integer value? Methods setFirstResult and setRowNumber take int value so they are not suitable for solving the problem when I need to get a row with number more then 2147483647.


#2

The int is for the number of pages and it’s unlikely that you are going to iterate over more than 2 billion pages, hence you don’t need a Long number.

What you are mistaking here is the Integer used for pagination with the Long identifier you might have used in your entity.

These are different concepts.