query.append(LFCertificateCourseModelImpl.ORDER_BY_JPQL);
}
String sql = query.toString();
Query q = session.createQuery(sql);
q.setFirstResult(0);
q.setMaxResults(2);
QueryPos qPos = QueryPos.getInstance(q);
if (certificateID != null) {
qPos.add(certificateID.longValue());
}
if (orderByComparator != null) {
Object[] values = orderByComparator.getOrderByConditionValues(lfCertificateCourse);
for (Object value : values) {
qPos.add(value);
}
}
List<LFCertificateCourse> list = q.list();
if (list.size() == 2) {
return list.get(1);
} else {
return null;