Package org.hibernate.criterion

Examples of org.hibernate.criterion.Criterion


   * @param value
   * @param criterions
   */
  private static void addPrimativeCriterion(String name, Object value, List<Criterion> criterions,
      boolean ignoreZero) {
    Criterion criterion = null;
    if (value instanceof Number) {
      if (ignoreZero) {
        if (0 != ((Number) value).intValue()) {
          criterion = eqCriterion(name, value);
        }
View Full Code Here


      Session session = getSessionFactory().getCurrentSession();
      Criteria criteria = session.createCriteria(getFeatureInfo().getDataSourceName());
      if (filter != null) {
        if (filter != Filter.INCLUDE) {
          CriteriaVisitor visitor = new CriteriaVisitor((HibernateFeatureModel) featureModel, dateFormat);
          Criterion c = (Criterion) filter.accept(visitor, criteria);
          if (c != null) {
            criteria.add(c);
          }
        }
      }
View Full Code Here

        .getAttributes());
    Session session = getSessionFactory().getCurrentSession();
    Criteria criteria = session.createCriteria(attributeInfo.getFeature().getDataSourceName());
    CriteriaVisitor visitor = new CriteriaVisitor((HibernateFeatureModel) getFeatureModel(), dateFormat);
    if (filter != null) {
      Criterion c = (Criterion) filter.accept(visitor, null);
      if (c != null) {
        criteria.add(c);
      }
    }
    List<Attribute<?>> attributes = new ArrayList<Attribute<?>>();
View Full Code Here

  private Envelope getBoundsLocal(Filter filter) throws LayerException {
    try {
      Session session = getSessionFactory().getCurrentSession();
      Criteria criteria = session.createCriteria(getFeatureInfo().getDataSourceName());
      CriteriaVisitor visitor = new CriteriaVisitor((HibernateFeatureModel) getFeatureModel(), dateFormat);
      Criterion c = (Criterion) filter.accept(visitor, criteria);
      if (c != null) {
        criteria.add(c);
      }
      criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY);
      List<?> features = criteria.list();
View Full Code Here

  // -------------------------------------------------------------------------
  // FilterVisitor implementation:
  // -------------------------------------------------------------------------

  public Object visit(And filter, Object userData) {
    Criterion c = null;
    for (Filter element : filter.getChildren()) {
      if (c == null) {
        c = (Criterion) element.accept(this, userData);
      } else {
        c = Restrictions.and(c, (Criterion) element.accept(this, userData));
View Full Code Here

    }
    return c;
  }

  public Object visit(Not filter, Object userData) {
    Criterion c = (Criterion) filter.getFilter().accept(this, userData);
    return Restrictions.not(c);
  }
View Full Code Here

    Criterion c = (Criterion) filter.getFilter().accept(this, userData);
    return Restrictions.not(c);
  }

  public Object visit(Or filter, Object userData) {
    Criterion c = null;
    for (Filter element : filter.getChildren()) {
      if (c == null) {
        c = (Criterion) element.accept(this, userData);
      } else {
        c = Restrictions.or(c, (Criterion) element.accept(this, userData));
View Full Code Here

    }
    return propertyName;
  }

  public String getWithClause(String path) {
    final Criterion criterion = withClauseMap.get( path );
    return criterion == null ? null : criterion.toSqlString( getCriteria( path ), this );
  }
View Full Code Here

   * (non-Javadoc)
   * @see com.github.dactiv.orm.core.hibernate.restriction.CriterionSingleValueSupport#build(com.github.dactiv.orm.core.PropertyFilter)
   */
  public Criterion build(PropertyFilter filter) {
    Object value = convertMatchValue(filter.getMatchValue(), filter.getFieldType());
    Criterion criterion = null;
    if (filter.hasMultiplePropertyNames()) {
      Disjunction disjunction = Restrictions.disjunction();
      for (String propertyName:filter.getPropertyNames()) {
        disjunction.add(build(propertyName,value));
      }
View Full Code Here

   * @param restrictionName 约束名称,参考{@link CriterionBuilder}的实现类
   *
   * @return List
   */
  public List<T> findByProperty(String propertyName,Object value,String restrictionName,Order ...orders) {
    Criterion criterion = HibernateRestrictionBuilder.getRestriction(propertyName, value, restrictionName);
    Criteria criteria = createCriteria(criterion);
    setOrderToCriteria(criteria, orders);
    return createCriteria(criterion).list();
  }
View Full Code Here

TOP

Related Classes of org.hibernate.criterion.Criterion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.