|
38 | 38 | import javax.persistence.criteria.Join; |
39 | 39 | import javax.persistence.criteria.JoinType; |
40 | 40 | import javax.persistence.metamodel.Attribute; |
| 41 | +import javax.persistence.metamodel.Attribute.PersistentAttributeType; |
41 | 42 | import javax.persistence.metamodel.Bindable; |
42 | 43 | import javax.persistence.metamodel.ManagedType; |
43 | 44 | import javax.persistence.metamodel.PluralAttribute; |
44 | 45 | import javax.persistence.metamodel.SingularAttribute; |
45 | | -import javax.persistence.metamodel.Attribute.PersistentAttributeType; |
46 | 46 |
|
47 | 47 | import org.springframework.core.annotation.AnnotationUtils; |
48 | 48 | import org.springframework.dao.InvalidDataAccessApiUsageException; |
|
73 | 73 | * @author Mohammad Hewedy |
74 | 74 | * @author Andriy Redko |
75 | 75 | * @author Peter Großmann |
| 76 | + * @author Greg Turnquist |
76 | 77 | */ |
77 | 78 | public abstract class QueryUtils { |
78 | 79 |
|
@@ -291,7 +292,9 @@ private static String getOrderClause(Set<String> joinAliases, Set<String> select |
291 | 292 | checkSortExpression(order); |
292 | 293 |
|
293 | 294 | if (selectionAlias.contains(property)) { |
294 | | - return String.format("%s %s", property, toJpaDirection(order)); |
| 295 | + return String.format("%s %s", // |
| 296 | + order.isIgnoreCase() ? String.format("lower(%s)", property) : property, // |
| 297 | + toJpaDirection(order)); |
295 | 298 | } |
296 | 299 |
|
297 | 300 | boolean qualifyReference = !property.contains("("); // ( indicates a function |
@@ -465,6 +468,7 @@ public static String createCountQueryFor(String originalQuery) { |
465 | 468 | * @param originalQuery must not be {@literal null}. |
466 | 469 | * @param countProjection may be {@literal null}. |
467 | 470 | * @return a query String to be used a count query for pagination. Guaranteed to be not {@literal null}. |
| 471 | + * @return a query String to be used a count query for pagination. Guaranteed to be not {@literal null}. |
468 | 472 | * @since 1.6 |
469 | 473 | * @deprecated use {@link DeclaredQuery#deriveCountQuery(String, String)} instead. |
470 | 474 | */ |
|
0 commit comments