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