當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。