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

下面列出了org.hibernate.criterion.Restrictions#lt ( ) 实例代码,或者点击链接到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 项目: dhis2-core   文件: LessThanOperator.java
@Override
public Criterion getHibernateCriterion( QueryPath queryPath )
{
    Property property = queryPath.getProperty();

    if ( property.isCollection() )
    {
        Integer value = QueryUtils.parseValue( Integer.class, args.get( 0 ) );

        if ( value == null )
        {
            throw new QueryException( "Left-side is collection, and right-side is not a valid integer, so can't compare by size." );
        }

        return Restrictions.sizeLt( queryPath.getPath(), value );
    }

    return Restrictions.lt( queryPath.getPath(), args.get( 0 ) );
}
 
源代码3 项目: DWSurvey   文件: SurveyAnswerManagerImpl.java
/**
 * 取一份卷子回答的数据
 */
public Page<SurveyAnswer> answerPage(Page<SurveyAnswer> page,String surveyId){
	Criterion cri1=Restrictions.eq("surveyId", surveyId);
	Criterion cri2=Restrictions.lt("handleState", 2);
	page.setOrderBy("endAnDate");
	page.setOrderDir("desc");
	page=findPage(page, cri1, cri2);
	return page;
}
 
源代码4 项目: DWSurvey   文件: HibernateDao.java
/**
 * 按属性条件参数创建Criterion,辅助函数.
 */
protected Criterion buildCriterion(final String propertyName, final Object propertyValue, final MatchType matchType) {
	AssertUtils.hasText(propertyName, "propertyName不能为空");
	Criterion criterion = null;
	//根据MatchType构造criterion
	switch (matchType) {
	case EQ:
		criterion = Restrictions.eq(propertyName, propertyValue);
		break;
	case LIKE:
		criterion = Restrictions.like(propertyName, (String) propertyValue, MatchMode.ANYWHERE);
		break;

	case LE:
		criterion = Restrictions.le(propertyName, propertyValue);
		break;
	case LT:
		criterion = Restrictions.lt(propertyName, propertyValue);
		break;
	case GE:
		criterion = Restrictions.ge(propertyName, propertyValue);
		break;
	case GT:
		criterion = Restrictions.gt(propertyName, propertyValue);
		break;
	case NE:
		criterion = Restrictions.ne(propertyName, propertyValue);
	}
	return criterion;
}
 
源代码5 项目: geomajas-project-server   文件: CriteriaVisitor.java
/** {@inheritDoc} */
@Override
public Object visit(PropertyIsLessThan filter, Object userData) {
	String propertyName = getPropertyName(filter.getExpression1());
	String finalName = parsePropertyName(propertyName, userData);

	Object literal = getLiteralValue(filter.getExpression2());
	return Restrictions.lt(finalName, castLiteral(literal, propertyName));
}
 
源代码6 项目: geomajas-project-server   文件: CriteriaVisitor.java
/** {@inheritDoc} */
@Override
public Object visit(Before before, Object extraData) {
	String propertyName = getPropertyName(before.getExpression1());
	String finalName = parsePropertyName(propertyName, before);
	Object literal = getLiteralValue(before.getExpression2());
	if (literal instanceof Date) {
		return Restrictions.lt(finalName, literal);
	} else {
		throw new UnsupportedOperationException("visit(Object userData)");
	}
}
 
源代码7 项目: DataHubSystem   文件: SQLVisitor.java
private Criterion internalCriterionComparative(
      BinaryOperator operator, String property, Object value)
{
   Criterion criterion;
   switch (operator)
   {
      case EQ:
      {
         criterion = Restrictions.eq(property, value);
         break;
      }
      case NE:
      {
         criterion = Restrictions.ne(property, value);
         break;
      }
      case GT:
      {
         criterion = Restrictions.gt(property, value);
         break;
      }
      case GE:
      {
         criterion = Restrictions.ge(property, value);
         break;
      }
      case LT:
      {
         criterion = Restrictions.lt(property, value);
         break;
      }
      case LE:
      {
         criterion = Restrictions.le(property, value);
         break;
      }
      default:
         throw new UnsupportedOperationException(
               "Unsupported operation: " + operator.toUriLiteral());
   }
   return criterion;
}
 
源代码8 项目: base-framework   文件: LtRestriction.java
public Criterion build(String propertyName, Object value) {
	return Restrictions.lt(propertyName, value);
}
 
源代码9 项目: lemon   文件: HibernateUtils.java
/**
 * 按属性条件参数创建Criterion,辅助函数.
 * 
 * @param propertyName
 *            String
 * @param propertyValue
 *            Object
 * @param matchType
 *            MatchType
 * @return Criterion
 */
public static Criterion buildCriterion(String propertyName,
        Object propertyValue, MatchType matchType) {
    Assert.hasText(propertyName, "propertyName不能为空");

    Criterion criterion = null;

    // 根据MatchType构造criterion
    switch (matchType) {
    case EQ:
        criterion = Restrictions.eq(propertyName, propertyValue);

        break;

    case NOT:
        criterion = Restrictions.ne(propertyName, propertyValue);

        break;

    case LIKE:
        criterion = Restrictions.like(propertyName, (String) propertyValue,
                MatchMode.ANYWHERE);

        break;

    case LE:
        criterion = Restrictions.le(propertyName, propertyValue);

        break;

    case LT:
        criterion = Restrictions.lt(propertyName, propertyValue);

        break;

    case GE:
        criterion = Restrictions.ge(propertyName, propertyValue);

        break;

    case GT:
        criterion = Restrictions.gt(propertyName, propertyValue);

        break;

    case IN:
        criterion = Restrictions.in(propertyName,
                (Collection) propertyValue);

        break;

    case INL:
        criterion = Restrictions.isNull(propertyName);

        break;

    case NNL:
        criterion = Restrictions.isNotNull(propertyName);

        break;

    default:
        criterion = Restrictions.eq(propertyName, propertyValue);

        break;
    }

    return criterion;
}