Skip to content

Commit

Permalink
Merge pull request DSpace#9077 from DSpace/backport-9067-to-dspace-7_x
Browse files Browse the repository at this point in the history
[Port dspace-7_x] Remove 'cross join' from count query in `update-handle-prefix` script
  • Loading branch information
tdonohue authored Sep 15, 2023
2 parents f23fd92 + e757b9d commit 88f4cda
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,11 @@ public List<Handle> findByPrefix(Context context, String prefix) throws SQLExcep

@Override
public long countHandlesByPrefix(Context context, String prefix) throws SQLException {


CriteriaBuilder criteriaBuilder = getCriteriaBuilder(context);
CriteriaQuery<Long> criteriaQuery = criteriaBuilder.createQuery(Long.class);
CriteriaQuery criteriaQuery = getCriteriaQuery(criteriaBuilder, Handle.class);

Root<Handle> handleRoot = criteriaQuery.from(Handle.class);
criteriaQuery.select(criteriaBuilder.count(criteriaQuery.from(Handle.class)));
criteriaQuery.select(handleRoot);
criteriaQuery.where(criteriaBuilder.like(handleRoot.get(Handle_.handle), prefix + "%"));
return countLong(context, criteriaQuery, criteriaBuilder, handleRoot);
}
Expand Down

0 comments on commit 88f4cda

Please sign in to comment.