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 {
231231 private static final List <Type > SUPPORTED_TYPES = Arrays .asList (Type .CONTAINING , Type .STARTING_WITH ,
232232 Type .ENDING_WITH , Type .LIKE );
233233
234+ private static final String PERCENT = "%" ;
235+
234236 private final Type type ;
235237
236238 /**
@@ -326,15 +328,15 @@ static Type getLikeTypeFrom(String expression) {
326328
327329 Assert .hasText (expression , "Expression must not be null or empty" );
328330
329- if (expression .matches ( "%.*%" )) {
331+ if (expression .startsWith ( PERCENT ) && expression . endsWith ( PERCENT )) {
330332 return Type .CONTAINING ;
331333 }
332334
333- if (expression .startsWith ("%" )) {
335+ if (expression .startsWith (PERCENT )) {
334336 return Type .ENDING_WITH ;
335337 }
336338
337- if (expression .endsWith ("%" )) {
339+ if (expression .endsWith (PERCENT )) {
338340 return Type .STARTING_WITH ;
339341 }
340342
You can’t perform that action at this time.
0 commit comments