File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -231,6 +231,8 @@ static class LikeParameterBinding extends ParameterBinding {
231
231
private static final List <Type > SUPPORTED_TYPES = Arrays .asList (Type .CONTAINING , Type .STARTING_WITH ,
232
232
Type .ENDING_WITH , Type .LIKE );
233
233
234
+ private static final String PERCENT = "%" ;
235
+
234
236
private final Type type ;
235
237
236
238
/**
@@ -326,15 +328,15 @@ static Type getLikeTypeFrom(String expression) {
326
328
327
329
Assert .hasText (expression , "Expression must not be null or empty" );
328
330
329
- if (expression .matches ( "%.*%" )) {
331
+ if (expression .startsWith ( PERCENT ) && expression . endsWith ( PERCENT )) {
330
332
return Type .CONTAINING ;
331
333
}
332
334
333
- if (expression .startsWith ("%" )) {
335
+ if (expression .startsWith (PERCENT )) {
334
336
return Type .ENDING_WITH ;
335
337
}
336
338
337
- if (expression .endsWith ("%" )) {
339
+ if (expression .endsWith (PERCENT )) {
338
340
return Type .STARTING_WITH ;
339
341
}
340
342
You can’t perform that action at this time.
0 commit comments