本文整理汇总了Java中javax.persistence.criteria.CriteriaBuilder.lower方法的典型用法代码示例。如果您正苦于以下问题:Java CriteriaBuilder.lower方法的具体用法?Java CriteriaBuilder.lower怎么用?Java CriteriaBuilder.lower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.persistence.criteria.CriteriaBuilder
的用法示例。
在下文中一共展示了CriteriaBuilder.lower方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: toPredicate
import javax.persistence.criteria.CriteriaBuilder; //导入方法依赖的package包/类
@Override
public Predicate toPredicate(final Root<?> leveringsautorisatieRoot, final CriteriaQuery<?> query, final CriteriaBuilder cb) {
final Root<Dienstbundel> dienstbundelRoot = query.from(Dienstbundel.class);
// Join dienst op leveringsautorisatie
final Predicate joinPredicateLeveringsautorisatie = leveringsautorisatieRoot.get(ID).in(dienstbundelRoot.get(LEVERINGSAUTORISATIE).get(ID));
// Dienstbundel
final Expression<String> attributeExpression = cb.lower(cb.function(UNACCENT, String.class, dienstbundelRoot.get("naam")));
final Expression<String> valueExpression =
cb.lower(
cb.function(
UNACCENT,
String.class,
cb.concat(cb.concat(cb.literal(WILDCARD), cb.literal(value.toString())), cb.literal(WILDCARD))));
final Predicate dienstBundelPredicate = cb.like(attributeExpression, valueExpression);
return cb.and(joinPredicateLeveringsautorisatie, dienstBundelPredicate);
}
示例2: toPredicate
import javax.persistence.criteria.CriteriaBuilder; //导入方法依赖的package包/类
@Override
public Predicate toPredicate(final Root<?> persoonRoot, final CriteriaQuery<?> query, final CriteriaBuilder cb) {
final Root<PersoonAdres> persoonAdressenRoot = query.from(PersoonAdres.class);
final Predicate joinPredicateAdressen = persoonRoot.get(ID).in(persoonAdressenRoot.get(PERSOON).get(ID));
final Predicate adresPredicate;
if (likePredicate) {
final Expression<String> attributeExpression = cb.lower(cb.function(UNACCENT, String.class, persoonAdressenRoot.get(field)));
final Expression<String> valueExpression =
cb.lower(
cb.function(
UNACCENT,
String.class,
cb.concat(cb.concat(cb.literal(WILDCARD), cb.literal(value.toString())), cb.literal(WILDCARD))));
adresPredicate = cb.like(attributeExpression, valueExpression);
} else {
adresPredicate = cb.equal(persoonAdressenRoot.get(field), value);
}
return cb.and(joinPredicateAdressen, adresPredicate);
}
示例3: toPredicate
import javax.persistence.criteria.CriteriaBuilder; //导入方法依赖的package包/类
@Override
public Predicate toPredicate(final Root<?> root, final CriteriaQuery<?> query, final CriteriaBuilder cb) {
// Like en case insensitive
final Path<String> path = PredicateBuilderUtil.<String>getPath(root, naam);
final Expression<String> attributeExpression = cb.lower(cb.function(UNACCENT, String.class, path));
final Expression<String> valueExpression =
cb.lower(cb.function(UNACCENT, String.class, cb.concat(cb.concat(cb.literal(WILDCARD), cb.literal(value.toString())), cb.literal(WILDCARD))));
return cb.like(attributeExpression, valueExpression);
}