Package org.hivedb.hibernate.simplified.session

Examples of org.hivedb.hibernate.simplified.session.HiveCriteriaImpl


  public Collection<T> findInRange(final String propertyName, final Object minValue, final Object maxValue) {
    checkForHiveIndexedProperty(propertyName);

    QueryCallback query = new QueryCallback() {
      public Collection<Object> execute(Session session) {
        HiveCriteria c = new HiveCriteriaImpl(session.createCriteria(getRespresentedClass()), getRespresentedClass());
        if (ReflectionTools.isComplexCollectionItemProperty(getRespresentedClass(), propertyName)) {
          c.createCriteria(propertyName).add(Restrictions.between("id", minValue, maxValue));
        } else {
          c.add(Restrictions.between(propertyName, minValue, maxValue));
        }
        return c.list();
      }
    };
    return (Collection<T>) transactionHelper.queryInTransaction(query, factory.openSession());
  }
View Full Code Here


  public Collection<T> findInRange(final String propertyName, final Object minValue, final Object maxValue, final Integer offSet, final Integer maxResultSetSize) {
    checkForHiveIndexedProperty(propertyName);

    QueryCallback query = new QueryCallback() {
      public Collection<Object> execute(Session session) {
        HiveCriteria c = new HiveCriteriaImpl(session.createCriteria(getRespresentedClass()), getRespresentedClass());
        if (ReflectionTools.isComplexCollectionItemProperty(getRespresentedClass(), propertyName)) {
          c.createCriteria(propertyName)
            .add(Restrictions.between("id", minValue, maxValue));
        } else {
          c.add(Restrictions.between(propertyName, minValue, maxValue));
        }
        c.setFirstResult(offSet);
        c.setMaxResults(maxResultSetSize);
        return c.list();
      }
    };
    return (Collection<T>) transactionHelper.queryInTransaction(query, factory.openSession());
  }
View Full Code Here

  public Integer getCountInRange(final String propertyName, final Object minValue, final Object maxValue) {
    checkForHiveIndexedProperty(propertyName);

    QueryCallback query = new QueryCallback() {
      public Collection<Object> execute(Session session) {
        HiveCriteria c = new HiveCriteriaImpl(session.createCriteria(config.getRepresentedInterface()).setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY), getRespresentedClass());
        if (ReflectionTools.isComplexCollectionItemProperty(getRespresentedClass(), propertyName)) {
          c.createCriteria(propertyName)
            .add(Restrictions.between("id", minValue, maxValue));
        } else {
          c.add(Restrictions.between(propertyName, minValue, maxValue));
        }
        c.setProjection(Projections.rowCount());
        return c.list();
      }
    };

    return (Integer) transactionHelper.querySingleInTransaction(query, factory.openSession());
  }
View Full Code Here

TOP

Related Classes of org.hivedb.hibernate.simplified.session.HiveCriteriaImpl

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.