Package org.hibernate.hql.ast.util

Examples of org.hibernate.hql.ast.util.ASTAppender


    if ( !getWalker().isShallowQuery() ) {
      // add the fetched entities
      List fromElements = fromClause.getProjectionList();
 
      ASTAppender appender = new ASTAppender( getASTFactory(), this )// Get ready to start adding nodes.
      int size = fromElements.size();
 
      Iterator iterator = fromElements.iterator();
      for ( int k = 0; iterator.hasNext(); k++ ) {
        FromElement fromElement = ( FromElement ) iterator.next();
 
        if ( fromElement.isFetch() ) {
          FromElement origin = null;
          if ( fromElement.getRealOrigin() == null ) {
            // work around that crazy issue where the tree contains
            // "empty" FromElements (no text); afaict, this is caused
            // by FromElementFactory.createCollectionJoin()
            if ( fromElement.getOrigin() == null ) {
              throw new QueryException( "Unable to determine origin of join fetch [" + fromElement.getDisplayText() + "]" );
            }
            else {
              origin = fromElement.getOrigin();
            }
          }
          else {
            origin = fromElement.getRealOrigin();
          }
          if ( !fromElementsForLoad.contains( origin ) ) {
            throw new QueryException(
                "query specified join fetching, but the owner " +
                "of the fetched association was not present in the select list " +
                "[" + fromElement.getDisplayText() + "]"
            );
          }
          Type type = fromElement.getSelectType();
          addCollectionFromElement( fromElement );
          if ( type != null ) {
            boolean collectionOfElements = fromElement.isCollectionOfValuesOrComponents();
            if ( !collectionOfElements ) {
              // Add the type to the list of returned sqlResultTypes.
              fromElement.setIncludeSubclasses( true );
              fromElementsForLoad.add( fromElement );
              //sqlResultTypeList.add( type );
              // Generate the select expression.
              String text = fromElement.renderIdentifierSelect( size, k );
              SelectExpressionImpl generatedExpr = ( SelectExpressionImpl ) appender.append( SqlTokenTypes.SELECT_EXPR, text, false );
              if ( generatedExpr != null ) {
                generatedExpr.setFromElement( fromElement );
              }
            }
          }
View Full Code Here


//      // NOTE : the isSubQuery() bit is a temporary hack...
//      throw new QuerySyntaxException( "JPA-QL compliance requires select clause" );
//    }
    List fromElements = fromClause.getProjectionList();

    ASTAppender appender = new ASTAppender( getASTFactory(), this )// Get ready to start adding nodes.
    int size = fromElements.size();
    ArrayList sqlResultTypeList = new ArrayList( size );
    ArrayList queryReturnTypeList = new ArrayList( size );

    Iterator iterator = fromElements.iterator();
    for ( int k = 0; iterator.hasNext(); k++ ) {
      FromElement fromElement = ( FromElement ) iterator.next();
      Type type = fromElement.getSelectType();

      addCollectionFromElement( fromElement );

      if ( type != null ) {
        boolean collectionOfElements = fromElement.isCollectionOfValuesOrComponents();
        if ( !collectionOfElements ) {
          if ( !fromElement.isFetch() ) {
            // Add the type to the list of returned sqlResultTypes.
            queryReturnTypeList.add( type );
          }
          fromElementsForLoad.add( fromElement );
          sqlResultTypeList.add( type );
          // Generate the select expression.
          String text = fromElement.renderIdentifierSelect( size, k );
          SelectExpressionImpl generatedExpr = ( SelectExpressionImpl ) appender.append( SqlTokenTypes.SELECT_EXPR, text, false );
          if ( generatedExpr != null ) {
            generatedExpr.setFromElement( fromElement );
          }
        }
      }
View Full Code Here

    }
  }

  private void renderNonScalarSelects(SelectExpression[] selectExpressions, FromClause currentFromClause)
  throws SemanticException {
    ASTAppender appender = new ASTAppender( getASTFactory(), this );
    final int size = selectExpressions.length;
    int nonscalarSize = 0;
    for ( int i = 0; i < size; i++ ) {
      if ( !selectExpressions[i].isScalar() ) nonscalarSize++;
    }
View Full Code Here

    if ( !getWalker().isShallowQuery() ) {
      // add the fetched entities
      List fromElements = fromClause.getProjectionList();
 
      ASTAppender appender = new ASTAppender( getASTFactory(), this )// Get ready to start adding nodes.
      int size = fromElements.size();
 
      Iterator iterator = fromElements.iterator();
      for ( int k = 0; iterator.hasNext(); k++ ) {
        FromElement fromElement = ( FromElement ) iterator.next();
 
        if ( fromElement.isFetch() ) {
          FromElement origin = null;
          if ( fromElement.getRealOrigin() == null ) {
            // work around that crazy issue where the tree contains
            // "empty" FromElements (no text); afaict, this is caused
            // by FromElementFactory.createCollectionJoin()
            if ( fromElement.getOrigin() == null ) {
              throw new QueryException( "Unable to determine origin of join fetch [" + fromElement.getDisplayText() + "]" );
            }
            else {
              origin = fromElement.getOrigin();
            }
          }
          else {
            origin = fromElement.getRealOrigin();
          }
          if ( !fromElementsForLoad.contains( origin ) ) {
            throw new QueryException(
                "query specified join fetching, but the owner " +
                "of the fetched association was not present in the select list " +
                "[" + fromElement.getDisplayText() + "]"
            );
          }
          Type type = fromElement.getSelectType();
          addCollectionFromElement( fromElement );
          if ( type != null ) {
            boolean collectionOfElements = fromElement.isCollectionOfValuesOrComponents();
            if ( !collectionOfElements ) {
              // Add the type to the list of returned sqlResultTypes.
              fromElement.setIncludeSubclasses( true );
              fromElementsForLoad.add( fromElement );
              //sqlResultTypeList.add( type );
              // Generate the select expression.
              String text = fromElement.renderIdentifierSelect( size, k );
              SelectExpressionImpl generatedExpr = ( SelectExpressionImpl ) appender.append( SqlTokenTypes.SELECT_EXPR, text, false );
              if ( generatedExpr != null ) {
                generatedExpr.setFromElement( fromElement );
              }
            }
          }
View Full Code Here

//      // NOTE : the isSubQuery() bit is a temporary hack...
//      throw new QuerySyntaxException( "JPA-QL compliance requires select clause" );
//    }
    List fromElements = fromClause.getProjectionList();

    ASTAppender appender = new ASTAppender( getASTFactory(), this )// Get ready to start adding nodes.
    int size = fromElements.size();
    ArrayList sqlResultTypeList = new ArrayList( size );
    ArrayList queryReturnTypeList = new ArrayList( size );

    Iterator iterator = fromElements.iterator();
    for ( int k = 0; iterator.hasNext(); k++ ) {
      FromElement fromElement = ( FromElement ) iterator.next();
      Type type = fromElement.getSelectType();

      addCollectionFromElement( fromElement );

      if ( type != null ) {
        boolean collectionOfElements = fromElement.isCollectionOfValuesOrComponents();
        if ( !collectionOfElements ) {
          if ( !fromElement.isFetch() ) {
            // Add the type to the list of returned sqlResultTypes.
            queryReturnTypeList.add( type );
          }
          fromElementsForLoad.add( fromElement );
          sqlResultTypeList.add( type );
          // Generate the select expression.
          String text = fromElement.renderIdentifierSelect( size, k );
          SelectExpressionImpl generatedExpr = ( SelectExpressionImpl ) appender.append( SqlTokenTypes.SELECT_EXPR, text, false );
          if ( generatedExpr != null ) {
            generatedExpr.setFromElement( fromElement );
          }
        }
      }
View Full Code Here

    }
  }

  private void renderNonScalarSelects(SelectExpression[] selectExpressions, FromClause currentFromClause)
  throws SemanticException {
    ASTAppender appender = new ASTAppender( getASTFactory(), this );
    final int size = selectExpressions.length;
    int nonscalarSize = 0;
    for ( int i = 0; i < size; i++ ) {
      if ( !selectExpressions[i].isScalar() ) nonscalarSize++;
    }
View Full Code Here

    if ( !getWalker().isShallowQuery() ) {
      // add the fetched entities
      List fromElements = fromClause.getProjectionList();
 
      ASTAppender appender = new ASTAppender( getASTFactory(), this )// Get ready to start adding nodes.
      int size = fromElements.size();
 
      Iterator iterator = fromElements.iterator();
      for ( int k = 0; iterator.hasNext(); k++ ) {
        FromElement fromElement = ( FromElement ) iterator.next();
 
        if ( fromElement.isFetch() ) {
          FromElement origin = null;
          if ( fromElement.getRealOrigin() == null ) {
            // work around that crazy issue where the tree contains
            // "empty" FromElements (no text); afaict, this is caused
            // by FromElementFactory.createCollectionJoin()
            if ( fromElement.getOrigin() == null ) {
              throw new QueryException( "Unable to determine origin of join fetch [" + fromElement.getDisplayText() + "]" );
            }
            else {
              origin = fromElement.getOrigin();
            }
          }
          else {
            origin = fromElement.getRealOrigin();
          }
          if ( !fromElementsForLoad.contains( origin ) ) {
            throw new QueryException(
                "query specified join fetching, but the owner " +
                "of the fetched association was not present in the select list " +
                "[" + fromElement.getDisplayText() + "]"
            );
          }
          Type type = fromElement.getSelectType();
          addCollectionFromElement( fromElement );
          if ( type != null ) {
            boolean collectionOfElements = fromElement.isCollectionOfValuesOrComponents();
            if ( !collectionOfElements ) {
              // Add the type to the list of returned sqlResultTypes.
              fromElement.setIncludeSubclasses( true );
              fromElementsForLoad.add( fromElement );
              //sqlResultTypeList.add( type );
              // Generate the select expression.
              String text = fromElement.renderIdentifierSelect( size, k );
              SelectExpressionImpl generatedExpr = ( SelectExpressionImpl ) appender.append( SqlTokenTypes.SELECT_EXPR, text, false );
              if ( generatedExpr != null ) {
                generatedExpr.setFromElement( fromElement );
              }
            }
          }
View Full Code Here

//      // NOTE : the isSubQuery() bit is a temporary hack...
//      throw new QuerySyntaxException( "JPA-QL compliance requires select clause" );
//    }
    List fromElements = fromClause.getProjectionList();

    ASTAppender appender = new ASTAppender( getASTFactory(), this )// Get ready to start adding nodes.
    int size = fromElements.size();
    ArrayList sqlResultTypeList = new ArrayList( size );
    ArrayList queryReturnTypeList = new ArrayList( size );

    Iterator iterator = fromElements.iterator();
    for ( int k = 0; iterator.hasNext(); k++ ) {
      FromElement fromElement = ( FromElement ) iterator.next();
      Type type = fromElement.getSelectType();

      addCollectionFromElement( fromElement );

      if ( type != null ) {
        boolean collectionOfElements = fromElement.isCollectionOfValuesOrComponents();
        if ( !collectionOfElements ) {
          if ( !fromElement.isFetch() ) {
            // Add the type to the list of returned sqlResultTypes.
            queryReturnTypeList.add( type );
          }
          fromElementsForLoad.add( fromElement );
          sqlResultTypeList.add( type );
          // Generate the select expression.
          String text = fromElement.renderIdentifierSelect( size, k );
          SelectExpressionImpl generatedExpr = ( SelectExpressionImpl ) appender.append( SqlTokenTypes.SELECT_EXPR, text, false );
          if ( generatedExpr != null ) {
            generatedExpr.setFromElement( fromElement );
          }
        }
      }
View Full Code Here

    }
  }

  private void renderNonScalarSelects(SelectExpression[] selectExpressions, FromClause currentFromClause)
  throws SemanticException {
    ASTAppender appender = new ASTAppender( getASTFactory(), this );
    final int size = selectExpressions.length;
    int nonscalarSize = 0;
    for ( int i = 0; i < size; i++ ) {
      if ( !selectExpressions[i].isScalar() ) nonscalarSize++;
    }
View Full Code Here

    if ( !getWalker().isShallowQuery() ) {
      // add the fetched entities
      List fromElements = fromClause.getProjectionList();
 
      ASTAppender appender = new ASTAppender( getASTFactory(), this )// Get ready to start adding nodes.
      int size = fromElements.size();
 
      Iterator iterator = fromElements.iterator();
      for ( int k = 0; iterator.hasNext(); k++ ) {
        FromElement fromElement = ( FromElement ) iterator.next();
 
        if ( fromElement.isFetch() ) {
          FromElement origin = null;
          if ( fromElement.getRealOrigin() == null ) {
            // work around that crazy issue where the tree contains
            // "empty" FromElements (no text); afaict, this is caused
            // by FromElementFactory.createCollectionJoin()
            if ( fromElement.getOrigin() == null ) {
              throw new QueryException( "Unable to determine origin of join fetch [" + fromElement.getDisplayText() + "]" );
            }
            else {
              origin = fromElement.getOrigin();
            }
          }
          else {
            origin = fromElement.getRealOrigin();
          }
          if ( !fromElementsForLoad.contains( origin ) ) {
            throw new QueryException(
                "query specified join fetching, but the owner " +
                "of the fetched association was not present in the select list " +
                "[" + fromElement.getDisplayText() + "]"
            );
          }
          Type type = fromElement.getSelectType();
          addCollectionFromElement( fromElement );
          if ( type != null ) {
            boolean collectionOfElements = fromElement.isCollectionOfValuesOrComponents();
            if ( !collectionOfElements ) {
              // Add the type to the list of returned sqlResultTypes.
              fromElement.setIncludeSubclasses( true );
              fromElementsForLoad.add( fromElement );
              //sqlResultTypeList.add( type );
              // Generate the select expression.
              String text = fromElement.renderIdentifierSelect( size, k );
              SelectExpressionImpl generatedExpr = ( SelectExpressionImpl ) appender.append( SqlTokenTypes.SELECT_EXPR, text, false );
              if ( generatedExpr != null ) {
                generatedExpr.setFromElement( fromElement );
              }
            }
          }
View Full Code Here

TOP

Related Classes of org.hibernate.hql.ast.util.ASTAppender

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.