# Pagination with Hibernate. Set Long as 'offset'.

**URL:** <https://discourse.hibernate.org/t/pagination-with-hibernate-set-long-as-offset/57>\
**Category:** Hibernate ORM\
**Created:** [January 11, 2018, 3:27pm UTC](https://discourse.hibernate.org/t/pagination-with-hibernate-set-long-as-offset/57 "2018-01-11T15:27:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![maksymus](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@maksymus](https://discourse.hibernate.org/u/maksymus)\
**Post date:** [January 11, 2018, 3:27pm UTC](https://discourse.hibernate.org/t/pagination-with-hibernate-set-long-as-offset/57/1 "2018-01-11T15:27:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![vlad](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vlad/32/658_2.png) [@vlad](https://discourse.hibernate.org/u/vlad)\
**Post date:** [January 11, 2018, 3:30pm UTC](https://discourse.hibernate.org/t/pagination-with-hibernate-set-long-as-offset/57/2 "2018-01-11T15:30:10Z")

</div>

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.
