Skip to content

Commit

Permalink
Bug fix. Only use pageSize and offset if >0
Browse files Browse the repository at this point in the history
  • Loading branch information
tdonohue committed Oct 31, 2023
1 parent 74c7235 commit 15de2d0
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ public List<EPerson> findAll(Context context, MetadataField metadataSortField, S
}

@Override
public List<EPerson> findByGroups(Context context, Set<Group> groups, int pageSize, int offset) throws SQLException {
public List<EPerson> findByGroups(Context context, Set<Group> groups, int pageSize, int offset)
throws SQLException {
Query query = createQuery(context,
"SELECT DISTINCT e FROM EPerson e " +
"JOIN e.groups g " +
Expand All @@ -122,10 +123,16 @@ public List<EPerson> findByGroups(Context context, Set<Group> groups, int pageSi
for (Group group : groups) {
idList.add(group.getID());
}

query.setParameter("idList", idList);

return list(query, pageSize, offset);
if (pageSize > 0) {
query.setMaxResults(pageSize);
}
if (offset > 0) {
query.setFirstResult(offset);
}

return list(query);
}

@Override
Expand Down

0 comments on commit 15de2d0

Please sign in to comment.