query.append("className ASC").append(", ");
query.append("classPK ASC").append(", ");
query.append("priority ASC");
}
Query q = session.createQuery(query.toString());
int queryPos = 0;
q.setString(queryPos++, companyId);
q.setString(queryPos++, className);
List list = new ArrayList();
if (getDialect().supportsLimit()) {
q.setMaxResults(end - begin);
q.setFirstResult(begin);
Iterator itr = q.list().iterator();
while (itr.hasNext()) {
AddressHBM addressHBM = (AddressHBM)itr.next();
list.add(AddressHBMUtil.model(addressHBM));
}
}
else {
ScrollableResults sr = q.scroll();
if (sr.first() && sr.scroll(begin)) {
for (int i = begin; i < end; i++) {
AddressHBM addressHBM = (AddressHBM)sr.get(0);
list.add(AddressHBMUtil.model(addressHBM));