Package org.hibernate.impl

Examples of org.hibernate.impl.CriteriaImpl$Subcriteria


    detachedCriteria.setProjection(projection);
    return this.getHibernateTemplate().execute(new HibernateCallback<Long>() {
     
      @Override
      public Long doInHibernate(Session session) throws HibernateException, SQLException {
        CriteriaImpl criteria = (CriteriaImpl)detachedCriteria.getExecutableCriteria(session);
        for (Iterator<?> iterator = criteria.iterateOrderings(); iterator.hasNext();) {
          iterator.next();
          iterator.remove();
        }
        if (criteria.getMaxResults() != null) {
          criteria.setMaxResults(Integer.MAX_VALUE);
        }
        if (criteria.getFirstResult() != null) {
          criteria.setFirstResult(0);
        }
        return (Long)criteria.uniqueResult();
      }
    });
  }
View Full Code Here


  /**
   * 执行count查询获得本次Criteria查询所能获得的对象总数.
   */
  @SuppressWarnings({ "unchecked", "rawtypes" })
  protected long countCriteriaResult(final Criteria c) {
    CriteriaImpl impl = (CriteriaImpl) c;

    // 先把Projection、ResultTransformer、OrderBy取出来,清空三者后再执行Count操作
    Projection projection = impl.getProjection();
    ResultTransformer transformer = impl.getResultTransformer();

    List<CriteriaImpl.OrderEntry> orderEntries = null;
    try {
      orderEntries = (List<OrderEntry>) ReflectionUtils.getFieldValue(impl,"orderEntries");
      ReflectionUtils.setFieldValue(impl, "orderEntries", new ArrayList());
View Full Code Here

    this.entityDao = entityDao;
  }

  @SuppressWarnings("unchecked")
  public <T> Page<T> paginateCriteria(Criteria criteria, PageLimit limit) {
    CriteriaImpl criteriaImpl = (CriteriaImpl) criteria;
    int totalCount = 0;
    List<T> targetList = null;
    if (null == criteriaImpl.getProjection()) {
      criteria.setFirstResult((limit.getPageNo() - 1) * limit.getPageSize()).setMaxResults(
          limit.getPageSize());
      targetList = criteria.list();
      Projection projection = null;
      criteria.setFirstResult(0).setMaxResults(1);
View Full Code Here

    return paginateQuery(query, params, limit);
  }

  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Page<?> paginateCriteria(Criteria criteria, PageLimit limit) {
    CriteriaImpl criteriaImpl = (CriteriaImpl) criteria;
    int totalCount = 0;
    List<?> targetList = null;
    if (null == criteriaImpl.getProjection()) {
      criteria.setFirstResult((limit.getPageNo() - 1) * limit.getPageSize()).setMaxResults(
          limit.getPageSize());
      targetList = criteria.list();
      Projection projection = null;
      criteria.setFirstResult(0).setMaxResults(1);
View Full Code Here

         */
        private static final long serialVersionUID = -2016788794945601848L;
        private CriteriaImpl m_impl;

        protected OnmsDetachedCriteria(String entityName) {
            this(new CriteriaImpl(entityName, null));
        }
View Full Code Here

        protected OnmsDetachedCriteria(String entityName) {
            this(new CriteriaImpl(entityName, null));
        }
       
        protected OnmsDetachedCriteria(String entityName, String alias) {
            this(new CriteriaImpl(entityName, alias, null));
        }
View Full Code Here

    this.entityDao = entityDao;
  }

  @SuppressWarnings("unchecked")
  public <T> Page<T> paginateCriteria(Criteria criteria, PageLimit limit) {
    CriteriaImpl criteriaImpl = (CriteriaImpl) criteria;
    int totalCount = 0;
    List<T> targetList = null;
    if (null == criteriaImpl.getProjection()) {
      criteria.setFirstResult((limit.getPageNo() - 1) * limit.getPageSize()).setMaxResults(
          limit.getPageSize());
      targetList = criteria.list();
      Projection projection = null;
      criteria.setFirstResult(0).setMaxResults(1);
View Full Code Here

    return paginateQuery(query, params, limit);
  }

  @SuppressWarnings({ "unchecked", "rawtypes" })
  public Page<?> paginateCriteria(Criteria criteria, PageLimit limit) {
    CriteriaImpl criteriaImpl = (CriteriaImpl) criteria;
    int totalCount = 0;
    List<?> targetList = null;
    if (null == criteriaImpl.getProjection()) {
      criteria.setFirstResult((limit.getPageNo() - 1) * limit.getPageSize()).setMaxResults(
          limit.getPageSize());
      targetList = criteria.list();
      Projection projection = null;
      criteria.setFirstResult(0).setMaxResults(1);
View Full Code Here

 
  private final CriteriaImpl impl;
  private final Criteria criteria;
 
  protected DetachedCriteria(String entityName) {
    impl = new CriteriaImpl(entityName, null);
    criteria = impl;
  }
View Full Code Here

    impl = new CriteriaImpl(entityName, null);
    criteria = impl;
  }
 
  protected DetachedCriteria(String entityName, String alias) {
    impl = new CriteriaImpl(entityName, alias, null);
    criteria = impl;
  }
View Full Code Here

TOP

Related Classes of org.hibernate.impl.CriteriaImpl$Subcriteria

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.