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