Package org.hibernate.internal

Examples of org.hibernate.internal.CriteriaImpl


 
  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 PageList getPageList(final CriteriaQuery cq, final boolean isOffset) {

    Criteria criteria = cq.getDetachedCriteria().getExecutableCriteria(
        getSession());
    CriteriaImpl impl = (CriteriaImpl) criteria;
    // 先把Projection和OrderBy条件取出来,清空两者来执行Count操作
    Projection projection = impl.getProjection();
    final int allCounts = ((Long) criteria.setProjection(
        Projections.rowCount()).uniqueResult()).intValue();
    criteria.setProjection(projection);
    if (projection == null) {
      criteria.setResultTransformer(CriteriaSpecification.ROOT_ENTITY);
View Full Code Here

  public DataTableReturn getDataTableReturn(final CriteriaQuery cq,
      final boolean isOffset) {

    Criteria criteria = cq.getDetachedCriteria().getExecutableCriteria(
        getSession());
    CriteriaImpl impl = (CriteriaImpl) criteria;
    // 先把Projection和OrderBy条件取出来,清空两者来执行Count操作
    Projection projection = impl.getProjection();
    final int allCounts = ((Long) criteria.setProjection(
        Projections.rowCount()).uniqueResult()).intValue();
    criteria.setProjection(projection);
    if (projection == null) {
      criteria.setResultTransformer(CriteriaSpecification.ROOT_ENTITY);
View Full Code Here

   */
  public DataGridReturn getDataGridReturn(final CriteriaQuery cq,
      final boolean isOffset) {
    Criteria criteria = cq.getDetachedCriteria().getExecutableCriteria(
        getSession());
    CriteriaImpl impl = (CriteriaImpl) criteria;
    // 先把Projection和OrderBy条件取出来,清空两者来执行Count操作
    Projection projection = impl.getProjection();
    final int allCounts = ((Long) criteria.setProjection(
        Projections.rowCount()).uniqueResult()).intValue();
    criteria.setProjection(projection);
    if (projection == null) {
      criteria.setResultTransformer(CriteriaSpecification.ROOT_ENTITY);
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 sub criteria => suspect
        //TODO some sub criteria might be ok (outer joins)
        sizeSafe = !impl.iterateExpressionEntries().hasNext() && !impl.iterateSubcriteria().hasNext();
      }
    }
    else {
      sizeSafe = true;
      isExplicitCriteria = false;
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

   */
  public static Criteria applyInlineCount(Criteria crit)
  {
      crit.setMaxResults(0);
      crit.setFirstResult(0);
      CriteriaImpl impl = (CriteriaImpl) crit;
      Iterator<OrderEntry> iter = impl.iterateOrderings();
      while (iter.hasNext()) {
        iter.next();
        iter.remove();
      }
    crit.setProjection( Projections.rowCount());
View Full Code Here

        if (pageRequest != null) {
            // see https://forum.hibernate.org/viewtopic.php?t=974802

            // Save original Projection and ResultTransformer
            CriteriaImpl cImpl = (CriteriaImpl) c;
            Projection origProjection = cImpl.getProjection();
            ResultTransformer origRt = cImpl.getResultTransformer();

            // Get total number of records by setting a rowCount projection
            page.setMaxRecords(findRowCount(c));

            // Restore original Projection and ResultTransformer
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

TOP

Related Classes of org.hibernate.internal.CriteriaImpl

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.