當前位置: 首頁>>代碼示例>>Java>>正文


Java Restrictions.ne方法代碼示例

本文整理匯總了Java中org.hibernate.criterion.Restrictions.ne方法的典型用法代碼示例。如果您正苦於以下問題:Java Restrictions.ne方法的具體用法?Java Restrictions.ne怎麽用?Java Restrictions.ne使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.hibernate.criterion.Restrictions的用法示例。


在下文中一共展示了Restrictions.ne方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: findStatsRowVarQus

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
@Override
	public List<Question> findStatsRowVarQus(SurveyDirectory survey) {
		Criterion criterion1=Restrictions.eq("belongId", survey.getId());
		Criterion criterion2=Restrictions.eq("tag", 2);
		
//		Criterion criterion31=Restrictions.ne("quType", QuType.FILLBLANK);
//		Criterion criterion32=Restrictions.ne("quType", QuType.MULTIFILLBLANK);
//		Criterion criterion33=Restrictions.ne("quType", QuType.ANSWER);
//		
////		Criterion criterion3=Restrictions.or(criterion31, criterion32);
//		//where s=2 and (fds !=1 or fds!=2 )
//		return questionDao.find(criterion1,criterion2,criterion31,criterion32,criterion33);
		
		Criterion criterion31=Restrictions.ne("quType", QuType.FILLBLANK);
		Criterion criterion32=Restrictions.ne("quType", QuType.MULTIFILLBLANK);
		Criterion criterion33=Restrictions.ne("quType", QuType.ANSWER);
		Criterion criterion34=Restrictions.ne("quType", QuType.CHENCHECKBOX);
		Criterion criterion35=Restrictions.ne("quType", QuType.CHENFBK);
		Criterion criterion36=Restrictions.ne("quType", QuType.CHENRADIO);
		Criterion criterion37=Restrictions.ne("quType", QuType.ENUMQU);
		Criterion criterion38=Restrictions.ne("quType", QuType.ORDERQU);
		Criterion criterion39=Restrictions.ne("quType", QuType.SCORE);
		
		return questionDao.find(criterion1,criterion2,criterion31,criterion32,criterion33,criterion34,criterion35,criterion36,criterion37,criterion38,criterion39);
//		return null;
	}
 
開發者ID:wkeyuan,項目名稱:DWSurvey,代碼行數:27,代碼來源:QuestionManagerImpl.java

示例2: findStatsColVarQus

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
@Override
	public List<Question> findStatsColVarQus(SurveyDirectory survey) {	
		Criterion criterion1=Restrictions.eq("belongId", survey.getId());
		Criterion criterion2=Restrictions.eq("tag", 2);
		
//		Criterion criterion31=Restrictions.ne("quType", QuType.FILLBLANK);
//		Criterion criterion32=Restrictions.ne("quType", QuType.MULTIFILLBLANK);
//		Criterion criterion33=Restrictions.ne("quType", QuType.ANSWER);
//		
////		Criterion criterion3=Restrictions.or(criterion31, criterion32);
//		//where s=2 and (fds !=1 or fds!=2 )
//		return questionDao.find(criterion1,criterion2,criterion31,criterion32,criterion33);
		
		Criterion criterion31=Restrictions.ne("quType", QuType.FILLBLANK);
		Criterion criterion32=Restrictions.ne("quType", QuType.MULTIFILLBLANK);
		Criterion criterion33=Restrictions.ne("quType", QuType.ANSWER);
		Criterion criterion34=Restrictions.ne("quType", QuType.CHENCHECKBOX);
		Criterion criterion35=Restrictions.ne("quType", QuType.CHENFBK);
		Criterion criterion36=Restrictions.ne("quType", QuType.CHENRADIO);
		Criterion criterion37=Restrictions.ne("quType", QuType.ENUMQU);
		Criterion criterion38=Restrictions.ne("quType", QuType.ORDERQU);
		Criterion criterion39=Restrictions.ne("quType", QuType.SCORE);
		
		return questionDao.find(criterion1,criterion2,criterion31,criterion32,criterion33,criterion34,criterion35,criterion36,criterion37,criterion38,criterion39);
	}
 
開發者ID:wkeyuan,項目名稱:DWSurvey,代碼行數:26,代碼來源:QuestionManagerImpl.java

示例3: findByNameUserUn

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
@Override
public SurveyDirectory findByNameUserUn(String id, String surveyName) {
	User user=accountManager.getCurUser();
	if(user!=null){
		List<Criterion> criterions=new ArrayList<Criterion>();
		Criterion eqName=Restrictions.eq("surveyName", surveyName);
		Criterion eqUserId=Restrictions.eq("userId", user.getId());
		criterions.add(eqName);
		criterions.add(eqUserId);
		
		if(id!=null && !"".equals(id)){
			Criterion eqId=Restrictions.ne("id", id);	
			criterions.add(eqId);
		}
		return surveyDirectoryDao.findFirst(criterions);
	}
	return null;
}
 
開發者ID:wkeyuan,項目名稱:DWSurvey,代碼行數:19,代碼來源:SurveyDirectoryManagerImpl.java

示例4: 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

示例5: validateBean

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
protected final void validateBean(B bean, boolean overrideSystem) throws InvalidDataException
{
	if( !overrideSystem && bean.isSystemType() )
	{
		throw new ModifyingSystemTypeException();
	}

	List<ValidationError> errors = new ArrayList<ValidationError>();

	// Ask the full implementation to do any checking
	doValidationBean(bean, errors);

	// Only one uuid per institution
	Criterion c4 = Restrictions.eq("uuid", bean.getUuid());
	Criterion c5 = Restrictions.eq("institution", CurrentInstitution.get());
	Criterion c6 = Restrictions.ne("id", bean.getId());

	if( entityDao.countByCriteria(c4, c5, c6) > 0 )
	{
		errors.add(new ValidationError("uuid",
			CurrentLocale.get("com.tle.core.services.entity.generic.validation.unique.uuid")));
	}

	if( !errors.isEmpty() )
	{
		throw new InvalidDataException(errors);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:29,代碼來源:AbstractEntityServiceImpl.java

示例6: validate

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
protected final void validate(@Nullable EntityEditingSession<B, T> session, T entity, boolean overrideSystem)
	throws InvalidDataException
{
	if( !overrideSystem )
	{
		ensureNonSystem(entity);
	}

	List<ValidationError> errors = new ArrayList<ValidationError>();

	// Ask the full implementation to do any checking
	doValidation(session, entity, errors);

	// Only one uuid per institution
	Criterion c4 = Restrictions.eq("uuid", entity.getUuid());
	Criterion c5 = Restrictions.eq("institution", CurrentInstitution.get());
	Criterion c6 = Restrictions.ne("id", entity.getId());

	if( entityDao.countByCriteria(c4, c5, c6) > 0 )
	{
		errors.add(new ValidationError("uuid",
			CurrentLocale.get("com.tle.core.services.entity.generic.validation.unique.uuid")));
	}

	if( !errors.isEmpty() )
	{
		throw new InvalidDataException(errors);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:30,代碼來源:AbstractEntityServiceImpl.java

示例7: checkInUse

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
private void checkInUse(TLEGroup group, boolean forAdd)
{
	Criterion c1 = forAdd ? null : Restrictions.ne("uuid", group.getUuid());
	Criterion c2 = Restrictions.eq("name", group.getName());
	Criterion c3 = Restrictions.eq("institution", CurrentInstitution.get());
	if( !dao.findAllByCriteria(c1, c2, c3).isEmpty() )
	{
		ValidationError error = new ValidationError("name", "Name already exists");
		throw new InvalidDataException(Collections.singletonList(error));
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:12,代碼來源:TLEGroupServiceImpl.java

示例8: findByNameUn

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
@Override
public QuestionBank findByNameUn(String id, String parentId, String bankName) {
	List<Criterion> criterions=new ArrayList<Criterion>();
	Criterion eqName=Restrictions.eq("bankName", bankName);
	Criterion eqParentId=Restrictions.eq("parentId", parentId);
	criterions.add(eqName);
	criterions.add(eqParentId);
	
	if(id!=null && !"".equals(id)){
		Criterion eqId=Restrictions.ne("id", id);	
		criterions.add(eqId);
	}
	return questionBankDao.findFirst(criterions);
}
 
開發者ID:wkeyuan,項目名稱:DWSurvey,代碼行數:15,代碼來源:QuestionBankManagerImpl.java

示例9: findByNameUn

import org.hibernate.criterion.Restrictions; //導入方法依賴的package包/類
@Override
public SurveyDirectory findByNameUn(String id,String parentId, String surveyName) {
	List<Criterion> criterions=new ArrayList<Criterion>();
	Criterion eqName=Restrictions.eq("surveyName", surveyName);
	Criterion eqParentId=Restrictions.eq("parentId", parentId);
	criterions.add(eqName);
	criterions.add(eqParentId);
	
	if(id!=null && !"".equals(id)){
		Criterion eqId=Restrictions.ne("id", id);	
		criterions.add(eqId);
	}
	return surveyDirectoryDao.findFirst(criterions);
}
 
開發者ID:wkeyuan,項目名稱:DWSurvey,代碼行數:15,代碼來源:SurveyDirectoryManagerImpl.java

示例10: 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.ne方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。