Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ static class LikeParameterBinding extends ParameterBinding {
private static final List<Type> SUPPORTED_TYPES = Arrays.asList(Type.CONTAINING, Type.STARTING_WITH,
Type.ENDING_WITH, Type.LIKE);

private static final String PERCENT = "%";

private final Type type;

/**
Expand Down Expand Up @@ -464,15 +466,15 @@ static Type getLikeTypeFrom(String expression) {

Assert.hasText(expression, "Expression must not be null or empty");

if (expression.matches("%.*%")) {
if (expression.startsWith(PERCENT) && expression.endsWith(PERCENT)) {
return Type.CONTAINING;
}

if (expression.startsWith("%")) {
if (expression.startsWith(PERCENT)) {
return Type.ENDING_WITH;
}

if (expression.endsWith("%")) {
if (expression.endsWith(PERCENT)) {
return Type.STARTING_WITH;
}

Expand Down