Java Code Examples for org.hibernate.criterion.Restrictions#ne()
The following examples show how to use
org.hibernate.criterion.Restrictions#ne() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CriteriaParameter.java From Knowage-Server with GNU Affero General Public License v3.0 | 6 votes |
public Criterion toHibernateCriterion() { Criterion restriction = null; switch (getMatch()) { case LIKE: restriction = Restrictions.like(getName(), (String) getValue(), MatchMode.ANYWHERE); break; case ILIKE: restriction = Restrictions.like(getName(), (String) getValue(), MatchMode.ANYWHERE).ignoreCase(); break; case NOT_EQ: restriction = Restrictions.ne(getName(), getValue()); break; case IN: restriction = Restrictions.in(getName(), (Object[]) getValue()); break; case NOT_IN: restriction = Restrictions.not(Restrictions.in(getName(), (Object[]) getValue())); break; default: restriction = Restrictions.eq(getName(), getValue()); break; } return restriction; }
Example 2
Source File: QuestionManagerImpl.java From DWSurvey with GNU Affero General Public License v3.0 | 6 votes |
@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; }
Example 3
Source File: QuestionManagerImpl.java From DWSurvey with GNU Affero General Public License v3.0 | 6 votes |
@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); }
Example 4
Source File: SurveyDirectoryManagerImpl.java From DWSurvey with GNU Affero General Public License v3.0 | 6 votes |
@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; }
Example 5
Source File: QuestionBankManagerImpl.java From DWSurvey with GNU Affero General Public License v3.0 | 5 votes |
@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); }
Example 6
Source File: SurveyDirectoryManagerImpl.java From DWSurvey with GNU Affero General Public License v3.0 | 5 votes |
@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); }
Example 7
Source File: HibernateDao.java From DWSurvey with GNU Affero General Public License v3.0 | 5 votes |
/** * 按属性条件参数创建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; }
Example 8
Source File: CriteriaVisitor.java From geomajas-project-server with GNU Affero General Public License v3.0 | 5 votes |
/** {@inheritDoc} */ @Override public Object visit(PropertyIsNotEqualTo filter, Object userData) { String propertyName = getPropertyName(filter.getExpression1()); String finalName = parsePropertyName(propertyName, userData); Object value = castLiteral(getLiteralValue(filter.getExpression2()), propertyName); return Restrictions.ne(finalName, value); }
Example 9
Source File: SQLVisitor.java From DataHubSystem with GNU Affero General Public License v3.0 | 4 votes |
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; }
Example 10
Source File: HibernateUtils.java From lemon with Apache License 2.0 | 2 votes |
/** * 按属性条件参数创建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; }
Example 11
Source File: NeRestriction.java From base-framework with Apache License 2.0 | 2 votes |
public Criterion build(String propertyName, Object value) { return value == null ? Restrictions.isNotNull(propertyName) : Restrictions.ne(propertyName, value); }