diff --git a/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java b/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java index 22c92930d1..ec9a05b209 100644 --- a/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java +++ b/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java @@ -610,8 +610,8 @@ private static javax.persistence.criteria.Order toJpaOrder(Order order, From expression = toExpressionRecursively(from, property); if (order.isIgnoreCase() && String.class.equals(expression.getJavaType())) { - Expression lower = cb.lower((Expression) expression); - return order.isAscending() ? cb.asc(lower) : cb.desc(lower); + Expression upper = cb.lower((Expression) expression); + return order.isAscending() ? cb.asc(upper) : cb.desc(upper); } else { return order.isAscending() ? cb.asc(expression) : cb.desc(expression); }