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


Java Restrictions.lt方法代码示例

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


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

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
/**
 * 按属性条件参数创建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;
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:33,代码来源:HibernateDao.java

示例3: removeExpiredPasses

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
@Transactional
public void removeExpiredPasses()
{
	Criterion c1 = Restrictions.lt("expiry", new Date());
	for( SharePass pass : dao.findAllByCriteria(c1) )
	{
		dao.delete(pass);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:11,代码来源:SharePassServiceImpl.java

示例4: deleteExpiredAccessEntries

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
@Transactional
public void deleteExpiredAccessEntries()
{
	Criterion c1 = Restrictions.isNotNull("expiry");
	Criterion c2 = Restrictions.lt("expiry", new Date());
	for( AccessEntry entry : aclDao.findAllByCriteria(c1, c2) )
	{
		aclDao.delete(entry);
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:12,代码来源:TLEAclManagerImpl.java

示例5: answerPage

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
/**
 * 取一份卷子回答的数据
 */
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;
}
 
开发者ID:wkeyuan,项目名称:DWSurvey,代码行数:12,代码来源:SurveyAnswerManagerImpl.java

示例6: restricions

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
@Override
public void restricions() {
	Session ses=null;
	//get the session
	ses=HibernateUtil.getSession();
	
		System.out.println("\n\tPRICE Less than 500");
		//create criteria
	Criteria c=ses.createCriteria(product.class);
	//create criterion objects for the restriction methods
	Criterion lt=Restrictions.lt("price", 500f);
	//add restriction to criteria
	c.add(lt);
	//execute the Criteria
	List<product> list=c.list();
	//display the list
		list.forEach(row->{
			System.out.println(row);
		});
		
	System.out.println("\n\tPRICE Greater than 500");
	
	Criteria c1=ses.createCriteria(product.class);
	
	Criterion gt=Restrictions.gt("price", 500f);
	c1.add(gt);
	List<product> list1=c1.list();
		list1.forEach(row->{
			System.out.println(row);
		});
		
System.out.println("\n\tPRICE Less than or Equal 500");
		Criteria c2=ses.createCriteria(product.class);
		
		Criterion le=Restrictions.le("price", 500f);
		c2.add(le);
		List<product> list2=c2.list();
			list2.forEach(row->{
				System.out.println(row);
			});
			
			System.out.println("\n\tPRICE Greater than or Equal 500");
					Criteria c3=ses.createCriteria(product.class);
					
					Criterion ge=Restrictions.ge("price", 500f);
					c3.add(ge);
					List<product> list3=c3.list();
						list3.forEach(row->{
							System.out.println(row);
						});
						
						
								Criteria c4=ses.createCriteria(product.class);
								
								Criterion eq=Restrictions.eq("price", 500f);
								c4.add(eq);
								List<product> list4=c4.list();
								System.out.println("\n\tPRICE  Equal 500");
									list4.forEach(row->{
										System.out.println(row);
									});
									//close the session
									HibernateUtil.closeSession(ses);
}
 
开发者ID:pratikdimble,项目名称:Hibernate_Criteria_Queries_Using_DAO_Using_MAVEN,代码行数:65,代码来源:DAO_IMPL.java

示例7: buildCriterion

import org.hibernate.criterion.Restrictions; //导入方法依赖的package包/类
/**
 * 按属性条件参数创建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;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:80,代码来源:HibernateUtils.java


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