Query q = session.createQuery(sql);
q.setFirstResult(0);
q.setMaxResults(2);
QueryPos qPos = QueryPos.getInstance(q);
if (authorID != null) {
qPos.add(authorID.intValue());
}
if (orderByComparator != null) {
Object[] values = orderByComparator.getOrderByConditionValues(lfSocialPackage);
for (Object value : values) {
qPos.add(value);
}
}
List<LFSocialPackage> list = q.list();