本文整理汇总了Java中org.hibernate.criterion.Restrictions.ilike方法的典型用法代码示例。如果您正苦于以下问题:Java Restrictions.ilike方法的具体用法?Java Restrictions.ilike怎么用?Java Restrictions.ilike使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.criterion.Restrictions
的用法示例。
在下文中一共展示了Restrictions.ilike方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: searchTerms
import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
public Pair<Long, List<TermResult>> searchTerms(Taxonomy taxonomy, String query, SelectionRestriction restriction,
int limit, boolean searchFullTerms)
{
final String searchField = (searchFullTerms ? "fullValue" : "value");
final Criterion c1 = Restrictions.eq("taxonomy", taxonomy);
final Criterion c2 = Restrictions.ilike(searchField, query.replace('*', '%'));
final Criterion c3 = getSearchRestrictionCriterion(restriction);
final long totalCount = termDao.countByCriteria(c1, c2, c3);
List<TermResult> results = Collections.emptyList();
if( totalCount > 0 )
{
List<Term> terms = termDao.findAllByCriteria(Order.asc(searchField), -1, limit, c1, c2, c3);
results = Lists.transform(terms, new Function<Term, TermResult>()
{
@Override
public TermResult apply(Term term)
{
return new TermResult(term.getValue(), term.getFullValue(), term.isLeaf());
}
});
}
return new Pair<Long, List<TermResult>>(totalCount, results);
}
示例2: getCategoryCriterionRestriction
import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
public static Criterion getCategoryCriterionRestriction(CategoryCriterion categoryCriterion) {
Criterion restriction = null;
if (categoryCriterion.prefix != null && categoryCriterion.prefix.length() > 0) {
if (categoryCriterion.caseSensitive) {
restriction = Restrictions.like(categoryCriterion.field, categoryCriterion.prefix, categoryCriterion.matchMode);
} else {
restriction = Restrictions.ilike(categoryCriterion.field, categoryCriterion.prefix, categoryCriterion.matchMode);
}
} else if (EmptyPrefixModes.NON_EMPTY_ROWS.equals(categoryCriterion.emptyPrefixMode)) { // (categoryCriterion.notEmpty) {
restriction = Restrictions.not(Restrictions.or(Restrictions.eq(categoryCriterion.field, ""), Restrictions.isNull(categoryCriterion.field)));
} else if (EmptyPrefixModes.EMPTY_ROWS.equals(categoryCriterion.emptyPrefixMode)) {
restriction = Restrictions.or(Restrictions.eq(categoryCriterion.field, ""), Restrictions.isNull(categoryCriterion.field));
// } else if (EmptyPrefixModes.ALL_ROWS.equals(categoryCriterion.emptyPrefixMode)) {
}
return restriction;
}
示例3: search
import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
public List<TLEGroup> search(String query)
{
Criterion c1 = Restrictions.ilike("name", query.replace('*', '%'));
Criterion c2 = Restrictions.eq("institution", CurrentInstitution.get());
return dao.findAllByCriteria(Order.asc("name"), -1, c1, c2);
}