List of usage examples for org.hibernate.criterion Restrictions isNotEmpty
public static Criterion isNotEmpty(String propertyName)
From source file:com.eharmony.matching.seeking.translator.hibernate.HibernateQueryTranslator.java
License:Apache License
@Override public Criterion notEmpty(String fieldName) { return Restrictions.isNotEmpty(fieldName); }
From source file:com.heliosapm.aa4h.parser.XMLQueryParser.java
License:Apache License
/** * Element Start SAX ContentHandler Method. * @param uri//from w w w .jav a 2 s . c o m * @param localName * @param qName * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) * @throws SAXException * TODO: Document supported tags in javadoc. */ @SuppressWarnings({ "unchecked" }) public void startElement(String uri, String localNameX, String qName, Attributes attrs) throws SAXException { if ("Query".equalsIgnoreCase(qName)) { queryName = attrs.getValue("name"); rootElementName = queryName; } else if ("Class".equalsIgnoreCase(qName)) { processCriteria(attrs); } else if ("Union".equalsIgnoreCase(qName)) { inDetached = true; DetachedCriteria dc = DetachedCriteria.forEntityName(className); criteriaStack.push(dc); } else if ("NamedQuery".equalsIgnoreCase(qName)) { isNamedQuery = true; namedQuery = attrs.getValue("name"); rootElementName = namedQuery; try { query = session.getNamedQuery(namedQuery); } catch (HibernateException he) { throw new SAXException("Failed to retrieve named query[" + namedQuery + "]", he); } } else if ("qparam".equalsIgnoreCase(qName)) { processQueryBind(attrs); } else if ("Join".equalsIgnoreCase(qName)) { processCriteria(attrs); } else if ("Projections".equalsIgnoreCase(qName)) { startProjection(attrs); } else if ("Projection".equalsIgnoreCase(qName)) { addProjection(attrs); } else if ("Order".equalsIgnoreCase(qName)) { if (isRowCountOnly() == false) { try { String name = attrs.getValue("name"); String type = attrs.getValue("type"); ((Criteria) criteriaStack.peek()) .addOrder(type.equalsIgnoreCase("asc") ? Order.asc(name) : Order.desc(name)); } catch (Exception e) { throw new SAXException("Unable To Parse GreaterThan:" + attrs.getValue("name"), e); } } } else if ("GreaterThan".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.gt(operator.getName(), operator.getNativeValue())); } catch (Exception e) { throw new SAXException("Unable To Parse GreaterThan:" + attrs.getValue("name"), e); } } else if ("GreaterThanOrEqual".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.ge(operator.getName(), operator.getNativeValue())); } catch (Exception e) { throw new SAXException("Unable To Parse GreaterThanOrEqual:" + attrs.getValue("name"), e); } } else if ("LessThan".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.lt(operator.getName(), operator.getNativeValue())); } catch (Exception e) { throw new SAXException("Unable To Parse LessThan:" + attrs.getValue("name"), e); } } else if ("LessThanOrEqual".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.le(operator.getName(), operator.getNativeValue())); } catch (Exception e) { throw new SAXException("Unable To Parse LessThanOrEqual:" + attrs.getValue("name"), e); } } else if ("Equals".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); if ("true".equalsIgnoreCase(attrs.getValue("not"))) { addCriterion(Restrictions.not(Restrictions.eq(operator.getName(), operator.getNativeValue()))); } else { addCriterion(Restrictions.eq(operator.getName(), operator.getNativeValue())); } } catch (Exception e) { throw new SAXException("Unable To Parse Equals:" + attrs.getValue("name"), e); } } else if ("Alias".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); ((Criteria) criteriaStack.peek()).createAlias(operator.getName(), operator.getValue()); } catch (Exception e) { throw new SAXException("Unable To Create Alias:" + attrs.getValue("name"), e); } } else if ("GreaterThanProperty".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.gtProperty(operator.getName(), operator.getName2())); } catch (Exception e) { throw new SAXException("Unable To Parse GreaterThanProperty:" + attrs.getValue("name"), e); } } else if ("GreaterThanOrEqualProperty".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.geProperty(operator.getName(), operator.getName2())); } catch (Exception e) { throw new SAXException("Unable To Parse GreaterThanOrEqualProperty:" + attrs.getValue("name"), e); } } else if ("LessThanProperty".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.ltProperty(operator.getName(), operator.getName2())); } catch (Exception e) { throw new SAXException("Unable To Parse LessThanProperty:" + attrs.getValue("name"), e); } } else if ("LessThanOrEqualProperty".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.leProperty(operator.getName(), operator.getName2())); } catch (Exception e) { throw new SAXException("Unable To Parse LessThanOrEqualProperty:" + attrs.getValue("name"), e); } } else if ("EqualsProperty".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); if ("true".equalsIgnoreCase(attrs.getValue("not"))) { addCriterion( Restrictions.not(Restrictions.eqProperty(operator.getName(), operator.getName2()))); } else { addCriterion(Restrictions.eqProperty(operator.getName(), operator.getName2())); } } catch (Exception e) { throw new SAXException("Unable To Parse EqualsProperty:" + attrs.getValue("name"), e); } } else if ("Like".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.like(operator.getName(), operator.getNativeValue())); } catch (Exception e) { throw new SAXException("Unable To Parse Like:" + attrs.getValue("name"), e); } } else if ("Between".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.between(operator.getName(), operator.getNativeValue(), operator.getNativeValue2())); } catch (Exception e) { throw new SAXException("Unable To Parse Between:" + attrs.getValue("name"), e); } } else if ("IsEmpty".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.isEmpty(operator.getName())); } catch (Exception e) { throw new SAXException("Unable To Parse IsEmpty:" + attrs.getValue("name"), e); } } else if ("IsNotEmpty".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.isNotEmpty(operator.getName())); } catch (Exception e) { throw new SAXException("Unable To Parse IsNotEmpty:" + attrs.getValue("name"), e); } } else if ("IsNull".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.isNull(operator.getName())); } catch (Exception e) { throw new SAXException("Unable To Parse IsNull:" + attrs.getValue("name"), e); } } else if ("IsNotNull".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); addCriterion(Restrictions.isNotNull(operator.getName())); } catch (Exception e) { throw new SAXException("Unable To Parse IsNotNull:" + attrs.getValue("name"), e); } } else if ("In".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); if (operator.isLiteral()) { addCriterion(new LiteralInExpression(operator.getName(), (String) operator.getNativeValue())); } else { addCriterion(Restrictions.in(operator.getName(), (Collection) operator.getNativeValue())); } } catch (Exception e) { throw new SAXException("Unable To Parse In:" + attrs.getValue("name"), e); } } else if ("SizeEquals".equalsIgnoreCase(qName)) { try { Operator operator = new Operator(attrs); int i = ((Integer) operator.getNativeValue()).intValue(); addCriterion(Restrictions.sizeEq(operator.getName(), i)); } catch (Exception e) { throw new SAXException("Unable To Parse SizeEquals:" + attrs.getValue("name"), e); } } else if ("Not".equalsIgnoreCase(qName)) { notStack.push(new Object()); } else if ("Or".equalsIgnoreCase(qName)) { opStack.push(Restrictions.disjunction()); } else if ("And".equalsIgnoreCase(qName)) { opStack.push(Restrictions.conjunction()); } else { throw new SAXException("Element Name[" + qName + "] Not Recognized."); } }
From source file:com.inkubator.hrm.dao.impl.EmpDataDaoImpl.java
private Criteria doSearchSalaryConfirmationByParam(SalaryConfirmationParameter param, Criteria criteria) { /**/* ww w .j a va2 s. com*/ * automatically get relations of jabatanByJabatanId, department, * company don't create alias for that entity, or will get error : * duplicate association path */ criteria = this.addJoinRelationsOfCompanyId(criteria, HrmUserInfoUtil.getCompanyId()); criteria.add(Restrictions.not(Restrictions.eq("status", HRMConstant.EMP_TERMINATION))); criteria.createAlias("bioData", "bioData", JoinType.INNER_JOIN); criteria.createAlias("golonganJabatan", "golonganJabatan", JoinType.INNER_JOIN); criteria.add(Restrictions.isNotEmpty("payTempKalkulasis")); if (StringUtils.isNotEmpty(param.getNik())) { criteria.add(Restrictions.like("nik", param.getNik(), MatchMode.START)); } if (StringUtils.isNotEmpty(param.getName())) { Disjunction disjunction = Restrictions.disjunction(); disjunction.add(Restrictions.like("bioData.firstName", param.getName(), MatchMode.START)); disjunction.add(Restrictions.like("bioData.lastName", param.getName(), MatchMode.START)); criteria.add(disjunction); } if (param.getGolonganJabatanId() != null && param.getGolonganJabatanId() != 0) { criteria.add(Restrictions.eq("golonganJabatan.id", param.getGolonganJabatanId())); } return criteria; }
From source file:com.qcadoo.model.api.search.SearchRestrictions.java
License:Open Source License
/** * Creates criterion which checks if "collection" field's size isn't empty. * //from w w w. j av a2 s . c om * @param field * field * @return criterion */ public static SearchCriterion isNotEmpty(final String field) { return new SearchCriterionImpl(Restrictions.isNotEmpty(field)); }
From source file:com.thoughtworks.go.server.dao.UserSqlMapDao.java
License:Apache License
public Users findNotificationSubscribingUsers() { return (Users) transactionTemplate.execute((TransactionCallback) transactionStatus -> { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(User.class); criteria.setCacheable(true);/*from w ww. ja v a 2 s . c o m*/ criteria.add(Restrictions.isNotEmpty("notificationFilters")); criteria.add(Restrictions.eq("enabled", true)); return new Users(criteria.list()); }); }
From source file:de.escidoc.core.aa.business.filter.RoleFilter.java
License:Open Source License
/** * Evaluate a CQL term node./*from w w w .jav a2s . c om*/ * * @param node CQL node * @return Hibernate query reflecting the given CQL query * @throws InvalidSearchQueryException thrown if the given search query could not be translated into a SQL query */ @Override protected Criterion evaluate(final CQLTermNode node) throws InvalidSearchQueryException { Criterion result = null; final Object[] parts = criteriaMap.get(node.getIndex()); final String value = node.getTerm(); if (parts != null && !specialCriteriaNames.contains(node.getIndex())) { result = evaluate(node.getRelation(), (String) parts[1], value, (Integer) parts[0] == COMPARE_LIKE); } else { final String columnName = node.getIndex(); if (columnName != null) { if ("limited".equals(columnName)) { result = Boolean.parseBoolean(value) ? Restrictions.isNotEmpty("scopeDefs") : Restrictions.isEmpty("scopeDefs"); } else if ("granted".equals(columnName)) { final DetachedCriteria subQuery = DetachedCriteria.forClass(RoleGrant.class, "rg"); subQuery.setProjection(Projections.rowCount()); subQuery.add(Restrictions.eqProperty("escidocRole.id", "r.id")); result = Boolean.parseBoolean(value) ? Subqueries.lt(0L, subQuery) : Subqueries.eq(0L, subQuery); } else if (columnName.equals(Constants.FILTER_CREATION_DATE) || columnName.equals(Constants.FILTER_PATH_CREATION_DATE)) { result = evaluate(node.getRelation(), "creationDate", value != null && value.length() > 0 ? new Date(new DateTime(value).getMillis()) : null, false); } else { throw new InvalidSearchQueryException("unknown filter criteria: " + columnName); } } } return result; }
From source file:de.escidoc.core.aa.business.persistence.hibernate.HibernateEscidocRoleDao.java
License:Open Source License
/** * See Interface for functional description. * * @see EscidocRoleDaoInterface #retrieveRoles(java.util.Map, int, int, java.lang.String, * de.escidoc.core.common.util.list.ListSorting) */// w ww . ja v a2 s . com @Override public List<EscidocRole> retrieveRoles(final Map<String, Object> criterias, final int offset, final int maxResults, final String orderBy, final ListSorting sorting) throws SqlDatabaseSystemException { final DetachedCriteria detachedCriteria = DetachedCriteria.forClass(EscidocRole.class, "r"); detachedCriteria.add(Restrictions.ne("id", EscidocRole.DEFAULT_USER_ROLE_ID)); if (criterias != null && !criterias.isEmpty()) { // ids final Set<String> roleIds = mergeSets((Set<String>) criterias.remove(Constants.DC_IDENTIFIER_URI), (Set<String>) criterias.remove(Constants.FILTER_PATH_ID)); if (roleIds != null && !roleIds.isEmpty()) { detachedCriteria.add(Restrictions.in("id", roleIds.toArray())); } // limited final String limited = (String) criterias.remove("limited"); if (limited != null) { if (Boolean.parseBoolean(limited)) { detachedCriteria.add(Restrictions.isNotEmpty("scopeDefs")); } else { detachedCriteria.add(Restrictions.isEmpty("scopeDefs")); } } // granted final String granted = (String) criterias.remove("granted"); if (granted != null) { final DetachedCriteria subQuery = DetachedCriteria.forClass(RoleGrant.class, "rg"); subQuery.setProjection(Projections.rowCount()); subQuery.add(Restrictions.eqProperty("escidocRole.id", "r.id")); if (Boolean.parseBoolean(granted)) { detachedCriteria.add(Subqueries.lt(0, subQuery)); } else { detachedCriteria.add(Subqueries.eq(0, subQuery)); } } for (final Entry<String, Object[]> stringEntry : criteriaMap.entrySet()) { final Object criteriaValue = criterias.remove(stringEntry.getKey()); if (criteriaValue != null) { final Object[] parts = stringEntry.getValue(); if (parts[0].equals(COMPARE_EQ)) { detachedCriteria.add(Restrictions.eq((String) parts[1], criteriaValue)); } else { detachedCriteria.add(Restrictions.like((String) parts[1], criteriaValue)); } } } } if (orderBy != null) { if (sorting == ListSorting.ASCENDING) { detachedCriteria.addOrder(Order.asc(propertiesNamesMap.get(orderBy))); } else if (sorting == ListSorting.DESCENDING) { detachedCriteria.addOrder(Order.desc(propertiesNamesMap.get(orderBy))); } } if (criterias != null && criterias.isEmpty()) { final List<EscidocRole> result; try { result = getHibernateTemplate().findByCriteria(detachedCriteria, offset, maxResults); } catch (final DataAccessException e) { throw new SqlDatabaseSystemException(e); } return result; } else { // unsupported filter criteria has been found, therefore the result // list must be empty. return new ArrayList<EscidocRole>(0); } }
From source file:grails.orm.HibernateCriteriaBuilder.java
License:Apache License
public org.grails.datastore.mapping.query.api.Criteria isNotEmpty(String property) { String propertyName = calculatePropertyName(property); addToCriteria(Restrictions.isNotEmpty(propertyName)); return this; }
From source file:grails.orm.HibernateCriteriaBuilder.java
License:Apache License
@SuppressWarnings("rawtypes") @Override/*from w ww .jav a2 s .c om*/ public Object invokeMethod(String name, Object obj) { Object[] args = obj.getClass().isArray() ? (Object[]) obj : new Object[] { obj }; if (paginationEnabledList && SET_RESULT_TRANSFORMER_CALL.equals(name) && args.length == 1 && args[0] instanceof ResultTransformer) { resultTransformer = (ResultTransformer) args[0]; return null; } if (isCriteriaConstructionMethod(name, args)) { if (criteria != null) { throwRuntimeException(new IllegalArgumentException("call to [" + name + "] not supported here")); } if (name.equals(GET_CALL)) { uniqueResult = true; } else if (name.equals(SCROLL_CALL)) { scroll = true; } else if (name.equals(COUNT_CALL)) { count = true; } else if (name.equals(LIST_DISTINCT_CALL)) { resultTransformer = CriteriaSpecification.DISTINCT_ROOT_ENTITY; } createCriteriaInstance(); // Check for pagination params if (name.equals(LIST_CALL) && args.length == 2) { paginationEnabledList = true; orderEntries = new ArrayList<Order>(); invokeClosureNode(args[1]); } else { invokeClosureNode(args[0]); } if (resultTransformer != null) { criteria.setResultTransformer(resultTransformer); } Object result; if (!uniqueResult) { if (scroll) { result = criteria.scroll(); } else if (count) { criteria.setProjection(Projections.rowCount()); result = criteria.uniqueResult(); } else if (paginationEnabledList) { // Calculate how many results there are in total. This has been // moved to before the 'list()' invocation to avoid any "ORDER // BY" clause added by 'populateArgumentsForCriteria()', otherwise // an exception is thrown for non-string sort fields (GRAILS-2690). criteria.setFirstResult(0); criteria.setMaxResults(Integer.MAX_VALUE); criteria.setProjection(Projections.rowCount()); int totalCount = ((Number) criteria.uniqueResult()).intValue(); // Restore the previous projection, add settings for the pagination parameters, // and then execute the query. if (projectionList != null && projectionList.getLength() > 0) { criteria.setProjection(projectionList); } else { criteria.setProjection(null); } for (Order orderEntry : orderEntries) { criteria.addOrder(orderEntry); } if (resultTransformer == null) { criteria.setResultTransformer(CriteriaSpecification.ROOT_ENTITY); } else if (paginationEnabledList) { // relevant to GRAILS-5692 criteria.setResultTransformer(resultTransformer); } // GRAILS-7324 look if we already have association to sort by Map argMap = (Map) args[0]; final String sort = (String) argMap.get(GrailsHibernateUtil.ARGUMENT_SORT); if (sort != null) { boolean ignoreCase = true; Object caseArg = argMap.get(GrailsHibernateUtil.ARGUMENT_IGNORE_CASE); if (caseArg instanceof Boolean) { ignoreCase = (Boolean) caseArg; } final String orderParam = (String) argMap.get(GrailsHibernateUtil.ARGUMENT_ORDER); final String order = GrailsHibernateUtil.ORDER_DESC.equalsIgnoreCase(orderParam) ? GrailsHibernateUtil.ORDER_DESC : GrailsHibernateUtil.ORDER_ASC; int lastPropertyPos = sort.lastIndexOf('.'); String associationForOrdering = lastPropertyPos >= 0 ? sort.substring(0, lastPropertyPos) : null; if (associationForOrdering != null && aliasMap.containsKey(associationForOrdering)) { addOrder(criteria, aliasMap.get(associationForOrdering) + "." + sort.substring(lastPropertyPos + 1), order, ignoreCase); // remove sort from arguments map to exclude from default processing. @SuppressWarnings("unchecked") Map argMap2 = new HashMap(argMap); argMap2.remove(GrailsHibernateUtil.ARGUMENT_SORT); argMap = argMap2; } } GrailsHibernateUtil.populateArgumentsForCriteria(grailsApplication, targetClass, criteria, argMap); PagedResultList pagedRes = new PagedResultList(criteria.list()); // Updated the paged results with the total number of records calculated previously. pagedRes.setTotalCount(totalCount); result = pagedRes; } else { result = criteria.list(); } } else { result = GrailsHibernateUtil.unwrapIfProxy(criteria.uniqueResult()); } if (!participate) { hibernateSession.close(); } return result; } if (criteria == null) createCriteriaInstance(); MetaMethod metaMethod = getMetaClass().getMetaMethod(name, args); if (metaMethod != null) { return metaMethod.invoke(this, args); } metaMethod = criteriaMetaClass.getMetaMethod(name, args); if (metaMethod != null) { return metaMethod.invoke(criteria, args); } metaMethod = criteriaMetaClass.getMetaMethod(GrailsClassUtils.getSetterName(name), args); if (metaMethod != null) { return metaMethod.invoke(criteria, args); } if (isAssociationQueryMethod(args) || isAssociationQueryWithJoinSpecificationMethod(args)) { final boolean hasMoreThanOneArg = args.length > 1; Object callable = hasMoreThanOneArg ? args[1] : args[0]; int joinType = hasMoreThanOneArg ? (Integer) args[0] : CriteriaSpecification.INNER_JOIN; if (name.equals(AND) || name.equals(OR) || name.equals(NOT)) { if (criteria == null) { throwRuntimeException( new IllegalArgumentException("call to [" + name + "] not supported here")); } logicalExpressionStack.add(new LogicalExpression(name)); invokeClosureNode(callable); LogicalExpression logicalExpression = logicalExpressionStack .remove(logicalExpressionStack.size() - 1); addToCriteria(logicalExpression.toCriterion()); return name; } if (name.equals(PROJECTIONS) && args.length == 1 && (args[0] instanceof Closure)) { if (criteria == null) { throwRuntimeException( new IllegalArgumentException("call to [" + name + "] not supported here")); } projectionList = Projections.projectionList(); invokeClosureNode(callable); if (projectionList != null && projectionList.getLength() > 0) { criteria.setProjection(projectionList); } return name; } final PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(targetClass, name); if (pd != null && pd.getReadMethod() != null) { ClassMetadata meta = sessionFactory.getClassMetadata(targetClass); Type type = meta.getPropertyType(name); if (type.isAssociationType()) { String otherSideEntityName = ((AssociationType) type) .getAssociatedEntityName((SessionFactoryImplementor) sessionFactory); Class oldTargetClass = targetClass; targetClass = sessionFactory.getClassMetadata(otherSideEntityName) .getMappedClass(EntityMode.POJO); if (targetClass.equals(oldTargetClass) && !hasMoreThanOneArg) { joinType = CriteriaSpecification.LEFT_JOIN; // default to left join if joining on the same table } associationStack.add(name); final String associationPath = getAssociationPath(); createAliasIfNeccessary(name, associationPath, joinType); // the criteria within an association node are grouped with an implicit AND logicalExpressionStack.add(new LogicalExpression(AND)); invokeClosureNode(callable); aliasStack.remove(aliasStack.size() - 1); if (!aliasInstanceStack.isEmpty()) { aliasInstanceStack.remove(aliasInstanceStack.size() - 1); } LogicalExpression logicalExpression = logicalExpressionStack .remove(logicalExpressionStack.size() - 1); if (!logicalExpression.args.isEmpty()) { addToCriteria(logicalExpression.toCriterion()); } associationStack.remove(associationStack.size() - 1); targetClass = oldTargetClass; return name; } } } else if (args.length == 1 && args[0] != null) { if (criteria == null) { throwRuntimeException(new IllegalArgumentException("call to [" + name + "] not supported here")); } Object value = args[0]; Criterion c = null; if (name.equals(ID_EQUALS)) { return eq("id", value); } if (name.equals(IS_NULL) || name.equals(IS_NOT_NULL) || name.equals(IS_EMPTY) || name.equals(IS_NOT_EMPTY)) { if (!(value instanceof String)) { throwRuntimeException(new IllegalArgumentException( "call to [" + name + "] with value [" + value + "] requires a String value.")); } String propertyName = calculatePropertyName((String) value); if (name.equals(IS_NULL)) { c = Restrictions.isNull(propertyName); } else if (name.equals(IS_NOT_NULL)) { c = Restrictions.isNotNull(propertyName); } else if (name.equals(IS_EMPTY)) { c = Restrictions.isEmpty(propertyName); } else if (name.equals(IS_NOT_EMPTY)) { c = Restrictions.isNotEmpty(propertyName); } } if (c != null) { return addToCriteria(c); } } throw new MissingMethodException(name, getClass(), args); }
From source file:kr.debop4j.data.hibernate.tools.CriteriaTool.java
License:Apache License
/** * Add is not empty.//from w w w . j a va 2 s .com * * @param dc the dc * @param propertyName the property name * @return the detached criteria */ public static DetachedCriteria addIsNotEmpty(DetachedCriteria dc, String propertyName) { return dc.add(Restrictions.isNotEmpty(propertyName)); }