CriteriaQuery<Object> query = cb.createQuery();
final Root<T> from = query.from(entityType);
query = query.select(from);
int i = 0;
Predicate where = null;
for (final String condition : conditions) {
final SingularAttribute<? super T, ?> attribute = et.getSingularAttribute(condition);
final Path<?> path = from.get(attribute);
final Class<?> javaType = attribute.getType().getJavaType();
final Predicate currentClause;
if (javaType.equals(String.class)) {
currentClause = cb.like((Expression<String>) path, (String) args[i++]);
} else if (Number.class.isAssignableFrom(javaType) || javaType.isPrimitive()) {
currentClause = cb.equal(path, args[i++]);
} else {