if ( session.getFactory().useScrollableResultSets() ) { // we can go straight to the first required row rs.absolute(firstRow); } else { // we need to step through the rows one row at a time (slow) for ( int m=0; m<firstRow; m++ ) rs.next(); } 如果支持scrollable result,使用ResultSet的absolute方法直接移到查询起点,如果不支持的话,使用循环语句,rs.next一点点的移过去。