Is there a more efficient way of making pagination in Hibernate than executing select and count queries?

前端 未结 11 1355
说谎
说谎 2020-12-04 16:36

Usually pagination queries look like this. Is there a better way instead of making two almost equal methods, one of which executing \"select *...\" and the other one \"count

11条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-04 17:22

    I found a way to do paging in hibernate without doing a select count (*) over a large dataset size. Look at the solution that I posted for my answer here.

    processing a large number of database entries with paging slows down with time

    you can perform paging one at a time without knowing how many pages you will need originally

提交回复
热议问题