当前位置: 首页>>代码示例>>Java>>正文


Java Restrictions.not方法代码示例

本文整理汇总了Java中org.hibernate.criterion.Restrictions.not方法的典型用法代码示例。如果您正苦于以下问题:Java Restrictions.not方法的具体用法?Java Restrictions.not怎么用?Java Restrictions.not使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.criterion.Restrictions的用法示例。


在下文中一共展示了Restrictions.not方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: queryComparison

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
private Criterion queryComparison(FieldExpression expression) {

        Operator operator = expression.getOperator();

        switch (operator) {
            case EQUALS:
                return Restrictions.eq(getFieldName(expression.getField()), expression.getValue());
    
            case NOT_EQUALS:
                return Restrictions.not(Restrictions.like(getFieldName(expression.getField()), expression.getValue()));
    
            case GT:
                return Restrictions.gt(getFieldName(expression.getField()), expression.getValue());
    
            case LT:
                return Restrictions.lt(getFieldName(expression.getField()), expression.getValue());
    
            default:
                return Restrictions.eq(getFieldName(expression.getField()), expression.getValue());
        }
    }
 
开发者ID:will-gilbert,项目名称:OSWf-OSWorkflow-fork,代码行数:22,代码来源:HibernateStore.java

示例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;
}
 
开发者ID:phoenixctms,项目名称:ctsms,代码行数:17,代码来源:CategoryCriterion.java

示例3: buildNested

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
private Criterion buildNested(NestedExpression nestedExpression) {
    
    Criterion full = null;

    for (int i = 0; i < nestedExpression.getExpressionCount(); i++) {
        Criterion expr;
        Expression expression = nestedExpression.getExpression(i);

        if (expression.isNested()) {
            expr = buildNested((NestedExpression) nestedExpression.getExpression(i));
        } else {
            FieldExpression sub = (FieldExpression) nestedExpression.getExpression(i);
            expr = queryComparison(sub);

            if (sub.isNegate()) {
                expr = Restrictions.not(expr);
            }
        }

        if (full == null) {
            full = expr;
        } else {
            switch (nestedExpression.getExpressionOperator()) {
            case AND:
                full = Restrictions.and(full, expr);
                break;

            case OR:
                full = Restrictions.or(full, expr);
            }
        }
    }

    return full;
}
 
开发者ID:will-gilbert,项目名称:OSWf-OSWorkflow-fork,代码行数:36,代码来源:HibernateStore.java


注:本文中的org.hibernate.criterion.Restrictions.not方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。