org.hibernate.criterion.Restrictions#sqlRestriction ( )源码实例Demo

下面列出了org.hibernate.criterion.Restrictions#sqlRestriction ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ctsms   文件: CriteriaUtil.java
private static org.hibernate.criterion.Criterion getRestrictionCriterion(RestrictionCriterionTypes restriction, String propertyName, Object value,
		org.hibernate.type.NullableType type) {
	if (PROPERTY_NAME_REGEXP.matcher(propertyName).find()) {
		switch (restriction) {
			case GT:
				return Restrictions.gt(propertyName, value);
			case GE:
				return Restrictions.ge(propertyName, value);
			case LT:
				return Restrictions.lt(propertyName, value);
			case LE:
				return Restrictions.le(propertyName, value);
			default:
				throw new IllegalArgumentException(MessageFormat.format(UNSUPPORTED_BINARY_RESTRICTION_CRITERION_TYPE, restriction.toString()));
		}
	} else {
		return Restrictions.sqlRestriction(MessageFormat.format(restriction.toString(), propertyName),
				//"  "substr({alias}.logical_path, 1, length(?)) = ?",
				new Object[] { value },
				new org.hibernate.type.NullableType[] { type });
	}
}
 
源代码2 项目: ctsms   文件: CriteriaUtil.java
private static org.hibernate.criterion.Criterion getRestrictionCriterion(RestrictionCriterionTypes restriction, String propertyName) {
	if (PROPERTY_NAME_REGEXP.matcher(propertyName).find()) {
		switch (restriction) {
			case IS_NULL:
				return Restrictions.isNull(propertyName);
			case IS_NOT_NULL:
				return Restrictions.isNotNull(propertyName);
			default:
				throw new IllegalArgumentException(MessageFormat.format(UNSUPPORTED_UNARY_RESTRICTION_CRITERION_TYPE, restriction.toString()));
		}
	} else {
		return Restrictions.sqlRestriction(MessageFormat.format(restriction.toString(), propertyName));
	}
}
 
源代码3 项目: dhis2-core   文件: NotTokenOperator.java
@Override
public Criterion getHibernateCriterion( QueryPath queryPath )
{
    String value = caseSensitive ? getValue( String.class ) : getValue( String.class ).toLowerCase();

    return Restrictions.sqlRestriction( "c_." + queryPath.getPath() + " !~* '" + TokenUtils.createRegex( value ) + "' " );
}
 
源代码4 项目: dhis2-core   文件: TokenOperator.java
@Override
public Criterion getHibernateCriterion( QueryPath queryPath )
{
    String value = caseSensitive ? getValue( String.class ) : getValue( String.class ).toLowerCase();

    return Restrictions.sqlRestriction( "c_." + queryPath.getPath() + " ~* '" + TokenUtils.createRegex( value ) + "'" );
}