Package org.hibernate.internal

Examples of org.hibernate.internal.CriteriaImpl$OrderEntry


public class DetachedCriteria implements CriteriaSpecification, Serializable {
  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

   * @param c Criteria对象
   *
   * @return long
   */
  protected long countCriteriaResult( 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) ReflectionUtils.getFieldValue(impl,"orderEntries");
      ReflectionUtils.setFieldValue(impl, "orderEntries", new ArrayList());
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

  public void setCriteria(Criteria criteria) {
    if ( criteria != null ) {
      isExplicitCriteria = true;
      sizeSafe = true;
      if ( criteria instanceof CriteriaImpl ) {
        CriteriaImpl impl = (CriteriaImpl) criteria;
        //restriction of subcriteria => suspect
        //TODO some subcriteria might be ok (outer joins)
        sizeSafe = !impl.iterateExpressionEntries().hasNext() && !impl.iterateSubcriteria().hasNext();
      }
    }
    else {
      sizeSafe = true;
      isExplicitCriteria = false;
View Full Code Here

   *
   * @param detachedCriteria
   * @return
   */
  protected int findCriteriaRowCount(final Criteria criteria) {
    CriteriaImpl impl = (CriteriaImpl) criteria;
    // 先把Projection、ResultTransformer、OrderBy取出来,清空三者后再执行Count操作
    Projection projection = impl.getProjection();
    ResultTransformer transformer = impl.getResultTransformer();
    // 将orderBy对象中的排序字段存入数组中
    List<?> orderEntries = (List<?>) accessor.getValue(criteria);
    // 将排序字段设置为空
    accessor.setValue(Collections.emptyList(), criteria);
    // 执行Count查询
    int count = ((Number) criteria.setProjection(Projections.rowCount()).uniqueResult()).intValue();
    // 将取出的参数设回bean
    impl.setProjection(projection);
    if (projection == null && transformer == null) {
      impl.setResultTransformer(CriteriaSpecification.ROOT_ENTITY);
    } else if (transformer != null) {
      impl.setResultTransformer(transformer);
    }
    accessor.setValue(orderEntries, impl);
    return count;

  }
View Full Code Here

  public void setCriteria(Criteria criteria) {
    if ( criteria != null ) {
      isExplicitCriteria = true;
      sizeSafe = true;
      if ( criteria instanceof CriteriaImpl ) {
        CriteriaImpl impl = (CriteriaImpl) criteria;
        //restriction of subcriteria => suspect
        //TODO some subcriteria might be ok (outer joins)
        sizeSafe = !impl.iterateExpressionEntries().hasNext() && !impl.iterateSubcriteria().hasNext();
      }
    }
    else {
      sizeSafe = true;
      isExplicitCriteria = false;
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.internal.CriteriaImpl$OrderEntry

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.