Package org.hibernate.criterion

Examples of org.hibernate.criterion.Order


  }

  @Override
  public List<T> doInHibernate(final Session session) throws HibernateException, SQLException {
    final GenericCriteria<T> criteria = new GenericCriteria<T>(session, clazz);
    final Order order = isAscending ? Order.asc(property) : Order.desc(property);
    criteria.addOrder(order);
    prepare(criteria);
    return criteria.list();
  }
View Full Code Here


    case 2:
      orderingField = "population";
      break;
    }
   
    Order order = (param.sSortDirection.equals("asc")) ? Order
        .asc(orderingField) : Order.desc(orderingField);
    criteria = criteria.addOrder(order);
   
    //pagination
    criteria = criteria.setFirstResult(param.iDisplayStart);
View Full Code Here

       * @see com.anasoft.os.daofusion.criteria.NestedPropertyCriterionVisitor#visit(com.anasoft.os.daofusion.criteria.SortCriterion)
       */
      public void visit(SortCriterion criterion) {
          String targetPropertyName = criterion.getTargetPropertyName();
         
          Order order = criterion.isSortAscending() ? Order.asc(targetPropertyName) : Order.desc(targetPropertyName);
         
          if (criterion.isIgnoreCase()) {
              order.ignoreCase();
          }
         
          AssociationPath associationPath = criterion.getAssociationPath();
            associationPathRegister.get(associationPath).addOrder(order);
      }
View Full Code Here

      return findUniqueByCriteria(Restrictions.eq("name", name));
   }

   @Override
   public List<AppManagerEntity> findAllSortByName() {
      Order order = Order.asc("name");
      return findByCriteria(new Order[] { order }, null, null);
   }
View Full Code Here

   private static final Logger logger = Logger.getLogger(DatastoreDAO.class);

   @Override
   public List<VcDatastoreEntity> findAllSortByName() {
      Order order = Order.asc("name");
      return this.findByCriteria(new Order[] { order }, null, null);
   }
View Full Code Here

   }

   @Override
   @Transactional(readOnly = true)
   public List<VcResourcePoolEntity> findAllOrderByClusterName() {
      Order order = Order.asc("vcCluster");
      return this.findByCriteria(new Order[] { order }, null, null);
   }
View Full Code Here

      return clusterNames;
   }

   @Override
   public List<String> findClustersByAppManager(String appManagerName) {
      Order order = Order.asc("name");
      List<ClusterEntity> clusters =
            findByCriteria(new Order[] { order }, null, null,
                  Restrictions.eq("appmanager", appManagerName));
      List<String> clusterNames = new ArrayList<String>();
      for (ClusterEntity cluster : clusters) {
View Full Code Here

        Ordering ordering = sortField.getOrdering();
       
        if (Ordering.ASCENDING.equals(ordering) || Ordering.DESCENDING.equals(ordering)) {
          String propertyName = getPropertyName(context, sortField.getExpression());
         
          Order order = Ordering.ASCENDING.equals(ordering) ?
              Order.asc(propertyName) : Order.desc(propertyName);
             
          criteria.addOrder(order);
        }
      }
View Full Code Here

        Criteria criteria = getSession()
                .createCriteria(getClassReference())
                .add(Restrictions.eq("active", true));

        Order order = getOrder();
        if (order != null) {
            criteria.addOrder(order);
        }

        return criteria.list();
View Full Code Here

    @Override
    public List<T> retrieveAll() {
        Criteria criteria = getSession()
                .createCriteria(getClassReference());

        Order order = getOrder();
        if (order != null) {
            criteria.addOrder(order);
        }

        return criteria.list();
View Full Code Here

TOP

Related Classes of org.hibernate.criterion.Order

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.