if (obc != null) {
query.append("ORDER BY " + obc.getOrderBy());
}
Query q = session.createQuery(query.toString());
int queryPos = 0;
q.setString(queryPos++, questionId);
q.setString(queryPos++, choiceId);
List list = new ArrayList();
if (getDialect().supportsLimit()) {
q.setMaxResults(end - begin);
q.setFirstResult(begin);
Iterator itr = q.list().iterator();
while (itr.hasNext()) {
PollsVoteHBM pollsVoteHBM = (PollsVoteHBM)itr.next();
list.add(PollsVoteHBMUtil.model(pollsVoteHBM));
}
}
else {
ScrollableResults sr = q.scroll();
if (sr.first() && sr.scroll(begin)) {
for (int i = begin; i < end; i++) {
PollsVoteHBM pollsVoteHBM = (PollsVoteHBM)sr.get(0);
list.add(PollsVoteHBMUtil.model(pollsVoteHBM));