if (hasRecords) {
// scroll the result set to the offset
scrollToOffset(conn, rs, queryContext.getOffset());
for (int i = 0; i < queryContext.getLength(); i++) {
// now materialize the ResultSet into a JetspeedPrincipal
RowReader rr = PersistenceBrokerFactory.defaultPersistenceBroker().getClassDescriptor(
PersistentJetspeedPrincipal.class).getRowReader();
Map<Object, Object> row = new HashMap<Object, Object>();
// TODO: optimize, just retrieve the id from the DB and setup
// a JetspeedPrincipal template on that.
rr.readObjectArrayFrom(rs, row);
PersistentJetspeedPrincipal p = (PersistentJetspeedPrincipal) rr.readObjectFrom(row);
QueryByCriteria query = new QueryByCriteria(p);
p = (PersistentJetspeedPrincipal) PersistenceBrokerFactory.defaultPersistenceBroker()
.getObjectByQuery(query);
results.add(p);
if (!rs.next()) {