15
15
*/
16
16
package org .springframework .data .jpa .repository .query ;
17
17
18
- import static org .springframework .data .repository .query .parser .Part .Type .IS_NOT_EMPTY ;
19
- import static org .springframework .data .repository .query .parser .Part .Type .NOT_CONTAINING ;
20
- import static org .springframework .data .repository .query .parser .Part .Type .NOT_LIKE ;
21
- import static org .springframework .data .repository .query .parser .Part .Type .SIMPLE_PROPERTY ;
18
+ import static org .springframework .data .repository .query .parser .Part .Type .*;
22
19
23
20
import jakarta .persistence .EntityManager ;
24
21
import jakarta .persistence .criteria .CriteriaQuery ;
39
36
import org .springframework .data .domain .Sort ;
40
37
import org .springframework .data .jpa .domain .JpaSort ;
41
38
import org .springframework .data .jpa .repository .query .JpqlQueryBuilder .ParameterPlaceholder ;
42
- import org .springframework .data .jpa .repository .query .JpqlQueryBuilder .PathAndOrigin ;
43
39
import org .springframework .data .jpa .repository .query .ParameterBinding .PartTreeParameterBinding ;
44
40
import org .springframework .data .jpa .repository .support .JpqlQueryTemplates ;
45
41
import org .springframework .data .mapping .PropertyPath ;
@@ -183,8 +179,8 @@ protected JpqlQueryBuilder.Select buildQuery(Sort sort) {
183
179
QueryUtils .checkSortExpression (order );
184
180
185
181
try {
186
- expression = JpqlQueryBuilder . expression ( JpqlUtils .toExpressionRecursively (metamodel , entity , entityType ,
187
- PropertyPath .from (order .getProperty (), entityType .getJavaType ()))) ;
182
+ expression = JpqlUtils .toExpressionRecursively (metamodel , entity , entityType ,
183
+ PropertyPath .from (order .getProperty (), entityType .getJavaType ()));
188
184
} catch (PropertyReferenceException e ) {
189
185
190
186
if (order instanceof JpaSort .JpaOrder jpaOrder && jpaOrder .isUnsafe ()) {
@@ -227,7 +223,7 @@ private JpqlQueryBuilder.Select doSelect(Sort sort) {
227
223
requiredSelection = getRequiredSelection (sort , returnedType );
228
224
}
229
225
230
- List <PathAndOrigin > paths = new ArrayList <>(requiredSelection .size ());
226
+ List <JpqlQueryBuilder . PathExpression > paths = new ArrayList <>(requiredSelection .size ());
231
227
for (String selection : requiredSelection ) {
232
228
paths .add (JpqlUtils .toExpressionRecursively (metamodel , entity , entityType ,
233
229
PropertyPath .from (selection , returnedType .getDomainType ()), true ));
@@ -251,7 +247,7 @@ private JpqlQueryBuilder.Select doSelect(Sort sort) {
251
247
252
248
} else {
253
249
254
- List <PathAndOrigin > paths = entityType .getIdClassAttributes ().stream ()//
250
+ List <JpqlQueryBuilder . PathExpression > paths = entityType .getIdClassAttributes ().stream ()//
255
251
.map (it -> JpqlUtils .toExpressionRecursively (metamodel , entity , entityType ,
256
252
PropertyPath .from (it .getName (), returnedType .getDomainType ()), true ))
257
253
.toList ();
@@ -320,7 +316,7 @@ public JpqlQueryBuilder.Predicate build() {
320
316
PropertyPath property = part .getProperty ();
321
317
Type type = part .getType ();
322
318
323
- PathAndOrigin pas = JpqlUtils .toExpressionRecursively (metamodel , entity , entityType , property );
319
+ JpqlQueryBuilder . PathExpression pas = JpqlUtils .toExpressionRecursively (metamodel , entity , entityType , property );
324
320
JpqlQueryBuilder .WhereStep where = JpqlQueryBuilder .where (pas );
325
321
JpqlQueryBuilder .WhereStep whereIgnoreCase = JpqlQueryBuilder .where (potentiallyIgnoreCase (pas ));
326
322
@@ -385,7 +381,7 @@ public JpqlQueryBuilder.Predicate build() {
385
381
return type .equals (SIMPLE_PROPERTY ) ? where .isNull () : where .isNotNull ();
386
382
}
387
383
388
- JpqlQueryBuilder .Expression expression = potentiallyIgnoreCase (property , placeholder (metadata ));
384
+ JpqlQueryBuilder .Expression expression = potentiallyIgnoreCase (property , placeholder (simple ));
389
385
return type .equals (SIMPLE_PROPERTY ) ? whereIgnoreCase .eq (expression ) : whereIgnoreCase .neq (expression );
390
386
case IS_EMPTY :
391
387
case IS_NOT_EMPTY :
@@ -420,8 +416,8 @@ private <T> JpqlQueryBuilder.Expression potentiallyIgnoreCase(JpqlQueryBuilder.O
420
416
* @param path must not be {@literal null}.
421
417
* @return
422
418
*/
423
- private <T > JpqlQueryBuilder .Expression potentiallyIgnoreCase (PathAndOrigin path ) {
424
- return potentiallyIgnoreCase (path .path (), JpqlQueryBuilder . expression ( path ) );
419
+ private <T > JpqlQueryBuilder .Expression potentiallyIgnoreCase (JpqlQueryBuilder . PathExpression path ) {
420
+ return potentiallyIgnoreCase (path .getPropertyPath (), path );
425
421
}
426
422
427
423
/**
0 commit comments