title: Implementing result paging in hibernate (getting total number of rows)
body: <p>How do I implement paging in Hibernate? The <a href="https://www.hibernate.org/hib_docs/v3/api/org/hibernate/Query.html" rel="noreferrer"><code>Query</code></a> objects has methods called <a href="https://www.hibernate.org/hib_docs/v3/api/org/hibernate/Query.html#setMaxResults(int)" rel="noreferrer"><code>setMaxResults</code></a> and <a href="https://www.hibernate.org/hib_docs/v3/api/org/hibernate/Query.html#setFirstResult(int)" rel="noreferrer"><code>setFirstResult</code></a> which are certainly helpful. But where can I get the total number of results, so that I can show link to last page of results, and print things such as results 200 to 250 of <em>xxx</em>?</p>