Package org.hivedb.hibernate

Examples of org.hivedb.hibernate.QueryCallback


      session.close();
    }
  }

  public<ID extends Serializable> QueryCallback newGetCallback(final ID id, final Class<?> clazz) {
    return new QueryCallback() {
      public Collection<Object> execute(Session session) {
        return Collections.singletonList(session.get(clazz, id));
      }
    };
  }
View Full Code Here


   *
   * @param id
   * @return
   */
  public T get(final ID id) {
    QueryCallback query = transactionHelper.newGetCallback(id, getRespresentedClass());
    T fetched = (T) transactionHelper.querySingleInTransaction(query, factory.openSession());

    if (fetched == null && exists(id))
      removeDirectoryEntry(id);
    return fetched;
View Full Code Here

  }

  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 {
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));
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));
View Full Code Here

TOP

Related Classes of org.hivedb.hibernate.QueryCallback

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.