Added use of criteriaQuery in pagination

Please review #21 , and merge to 1.0.x branch.