Implementing result paging in hibernate (getting total number of rows)

前端 未结 5 1625
谎友^
谎友^ 2020-12-09 19:44

How do I implement paging in Hibernate? The Query objects has methods called setMaxResults and setFirstResult which are certainly helpful. But where can I get the total numb

5条回答
  •  孤城傲影
    2020-12-09 20:10

    I personally think you should handle the paging in the front-end. I know this isn't that efficiënt but at least it would be less error prone.

    If you would use the count(*) thing what would happen if records get deleted from the table in between requests for a certain page? Lots of things could go wrong this way.

提交回复
热议问题