title: Hibernate sql exception when table empty
body: <p>The following code causes an exception when the Job table has no rows.</p>
  
  <pre><code>public List&lt;Job&gt; getAll(int currentPage, int pageSize) {
      return this.sessionFactory.getCurrentSession()
          .createCriteria(Job.class).addOrder(Order.asc("id"))
          .setFirstResult(currentPage * pageSize).setMaxResults(pageSize)
          .setFetchSize(pageSize).list();
  }
  </code></pre>
  
  <p>I am using SQL Server and the JTDS driver.</p>
  
  <p>The error i get is </p>
  
  <pre><code>java.sql.SQLException: ResultSet may only be accessed in a forward direction.
   net.sourceforge.jtds.jdbc.JtdsResultSet.checkScrollable(JtdsResultSet.java:319)
   net.sourceforge.jtds.jdbc.JtdsResultSet.absolute(JtdsResultSet.java:716)
   org.apache.commons.dbcp.DelegatingResultSet.absolute(DelegatingResultSet.java:335)
   org.hibernate.loader.Loader.advance(Loader.java:1469)
   org.hibernate.loader.Loader.getResultSet(Loader.java:1783)
   org.hibernate.loader.Loader.doQuery(Loader.java:662)
   org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
   org.hibernate.loader.Loader.doList(Loader.java:2211)
   org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2095)
   org.hibernate.loader.Loader.list(Loader.java:2090)
   org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:95)
   org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
   org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
  </code></pre>