Skip to content

Commit

Permalink
updated matcher in query interpreter
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed May 9, 2014
1 parent b1feb02 commit 94ce14d
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -19,6 +19,7 @@
import com.evolveum.midpoint.repo.sql.query.QueryException;
import com.evolveum.midpoint.repo.sql.query.restriction.ItemRestrictionOperation;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;
import org.hibernate.criterion.SimpleExpression;

Expand Down Expand Up @@ -71,13 +72,13 @@ protected Criterion basicMatch(ItemRestrictionOperation operation, String proper
criterion = Restrictions.isNull(propertyName);
break;
case STARTS_WITH:
criterion = Restrictions.like(propertyName, value + "%");
criterion = Restrictions.like(propertyName, (String) value, MatchMode.START);
break;
case ENDS_WITH:
criterion = Restrictions.like(propertyName, "%" + value);
criterion = Restrictions.like(propertyName, (String) value, MatchMode.END);
break;
case SUBSTRING:
criterion = Restrictions.like(propertyName, "%" + value + "%");
criterion = Restrictions.like(propertyName, (String) value, MatchMode.ANYWHERE);
break;
default:
throw new QueryException("Unknown operation '" + operation + "'.");
Expand Down

0 comments on commit 94ce14d

Please sign in to comment.