Package org.hibernate.hql.internal.ast.tree

Examples of org.hibernate.hql.internal.ast.tree.DotNode


    //
    // VALUE EXPRESSIONS
    //

    case HqlSqlTokenTypes.DOT:
      DotNode dotNode = (DotNode) ast;
      traverser.fastForwardToNextSiblingOf(dotNode);
      return dotNodeResolver.resolve(dotNode);

    case HqlSqlTokenTypes.NAMED_PARAM:
      ParameterNode paramNode = (ParameterNode) ast;
View Full Code Here


    //
    // VALUE EXPRESSIONS
    //

    case HqlSqlTokenTypes.DOT:
      DotNode dotNode = (DotNode) ast;
      traverser.fastForwardToNextSiblingOf(dotNode);
      return dotNodeResolver.resolve(dotNode);

    case HqlSqlTokenTypes.NAMED_PARAM:
      ParameterNode paramNode = (ParameterNode) ast;
View Full Code Here

      //              linked to different sql joins.
      //          2) here we would need to track each comparison individually, along with
      //              the join alias to which it applies and then pass that information
      //              back to the FromElement so it can pass it along to the JoinSequence
      if ( node instanceof DotNode ) {
        DotNode dotNode = (DotNode) node;
        FromElement fromElement = dotNode.getFromElement();
        if ( referencedFromElement != null ) {
          if ( fromElement != referencedFromElement ) {
            throw new HibernateException( "with-clause referenced two different from-clause elements" );
          }
        }
View Full Code Here

    }
    // The path AST should be a DotNode, and it should have been evaluated already.
    if ( path.getType() != SqlTokenTypes.DOT ) {
      throw new SemanticException( "Path expected for join!" );
    }
    DotNode dot = (DotNode) path;
    JoinType hibernateJoinType = JoinProcessor.toHibernateJoinType( joinType );
    dot.setJoinType( hibernateJoinType );    // Tell the dot node about the join type.
    dot.setFetch( fetch );
    // Generate an explicit join for the root dot node.   The implied joins will be collected and passed up
    // to the root dot node.
    dot.resolve( true, false, alias == null ? null : alias.getText() );

    final FromElement fromElement;
    if ( dot.getDataType() != null && dot.getDataType().isComponentType() ) {
      if ( dot.getDataType().isAnyType() ) {
        throw new SemanticException( "An AnyType attribute cannot be join fetched" );
        // ^^ because the discriminator (aka, the "meta columns") must be known to the SQL in
        //     a non-parameterized way.
      }
      FromElementFactory factory = new FromElementFactory(
          getCurrentFromClause(),
          dot.getLhs().getFromElement(),
          dot.getPropertyPath(),
          alias == null ? null : alias.getText(),
          null,
          false
      );
      fromElement = factory.createComponentJoin( (ComponentType) dot.getDataType() );
    }
    else {
      fromElement = dot.getImpliedJoin();
      fromElement.setAllPropertyFetch( propertyFetch != null );

      if ( with != null ) {
        if ( fetch ) {
          throw new SemanticException( "with-clause not allowed on fetched associations; use filters" );
View Full Code Here

    return impliedJoinType;
  }

  @Override
  protected AST lookupProperty(AST dot, boolean root, boolean inSelect) throws SemanticException {
    DotNode dotNode = (DotNode) dot;
    FromReferenceNode lhs = dotNode.getLhs();
    AST rhs = lhs.getNextSibling();
    switch ( rhs.getType() ) {
      case SqlTokenTypes.ELEMENTS:
      case SqlTokenTypes.INDICES:
        if ( LOG.isDebugEnabled() ) {
          LOG.debugf(
              "lookupProperty() %s => %s(%s)",
              dotNode.getPath(),
              rhs.getText(),
              lhs.getPath()
          );
        }
        CollectionFunction f = (CollectionFunction) rhs;
        // Re-arrange the tree so that the collection function is the root and the lhs is the path.
        f.setFirstChild( lhs );
        lhs.setNextSibling( null );
        dotNode.setFirstChild( f );
        resolve( lhs );            // Don't forget to resolve the argument!
        f.resolve( inSelect );    // Resolve the collection function now.
        return f;
      default:
        // Resolve everything up to this dot, but don't resolve the placeholders yet.
        dotNode.resolveFirstChild();
        return dotNode;
    }
  }
View Full Code Here

  protected void resolveSelectExpression(AST node) throws SemanticException {
    // This is called when it's time to fully resolve a path expression.
    int type = node.getType();
    switch ( type ) {
      case DOT: {
        DotNode dot = (DotNode) node;
        dot.resolveSelectExpression();
        break;
      }
      case ALIAS_REF: {
        // Notify the FROM element that it is being referenced by the select.
        FromReferenceNode aliasRefNode = (FromReferenceNode) node;
View Full Code Here

      //              linked to different sql joins.
      //          2) here we would need to track each comparison individually, along with
      //              the join alias to which it applies and then pass that information
      //              back to the FromElement so it can pass it along to the JoinSequence
      if ( node instanceof DotNode ) {
        DotNode dotNode = ( DotNode ) node;
        FromElement fromElement = dotNode.getFromElement();
        if ( referencedFromElement != null ) {
          if ( fromElement != referencedFromElement ) {
            throw new HibernateException( "with-clause referenced two different from-clause elements" );
          }
        }
View Full Code Here

    }
    // The path AST should be a DotNode, and it should have been evaluated already.
    if ( path.getType() != SqlTokenTypes.DOT ) {
      throw new SemanticException( "Path expected for join!" );
    }
    DotNode dot = ( DotNode ) path;
    JoinType hibernateJoinType = JoinProcessor.toHibernateJoinType( joinType );
    dot.setJoinType( hibernateJoinType )// Tell the dot node about the join type.
    dot.setFetch( fetch );
    // Generate an explicit join for the root dot node.   The implied joins will be collected and passed up
    // to the root dot node.
    dot.resolve( true, false, alias == null ? null : alias.getText() );

    final FromElement fromElement;
    if ( dot.getDataType() != null && dot.getDataType().isComponentType() ) {
      FromElementFactory factory = new FromElementFactory(
          getCurrentFromClause(),
          dot.getLhs().getFromElement(),
          dot.getPropertyPath(),
          alias == null ? null : alias.getText(),
          null,
          false
      );
      fromElement = factory.createComponentJoin( (ComponentType) dot.getDataType() );
    }
    else {
      fromElement = dot.getImpliedJoin();
      fromElement.setAllPropertyFetch( propertyFetch != null );

      if ( with != null ) {
        if ( fetch ) {
          throw new SemanticException( "with-clause not allowed on fetched associations; use filters" );
View Full Code Here

    return impliedJoinType;
  }

  @Override
    protected AST lookupProperty(AST dot, boolean root, boolean inSelect) throws SemanticException {
    DotNode dotNode = ( DotNode ) dot;
    FromReferenceNode lhs = dotNode.getLhs();
    AST rhs = lhs.getNextSibling();
    switch ( rhs.getType() ) {
      case SqlTokenTypes.ELEMENTS:
      case SqlTokenTypes.INDICES:
                if (LOG.isDebugEnabled()) LOG.debugf("lookupProperty() %s => %s(%s)",
                                                     dotNode.getPath(),
                                                     rhs.getText(),
                                                     lhs.getPath());
        CollectionFunction f = ( CollectionFunction ) rhs;
        // Re-arrange the tree so that the collection function is the root and the lhs is the path.
        f.setFirstChild( lhs );
        lhs.setNextSibling( null );
        dotNode.setFirstChild( f );
        resolve( lhs );      // Don't forget to resolve the argument!
        f.resolve( inSelect )// Resolve the collection function now.
        return f;
      default:
        // Resolve everything up to this dot, but don't resolve the placeholders yet.
        dotNode.resolveFirstChild();
        return dotNode;
    }
  }
View Full Code Here

    protected void resolveSelectExpression(AST node) throws SemanticException {
    // This is called when it's time to fully resolve a path expression.
    int type = node.getType();
    switch ( type ) {
      case DOT: {
        DotNode dot = ( DotNode ) node;
        dot.resolveSelectExpression();
        break;
      }
      case ALIAS_REF: {
        // Notify the FROM element that it is being referenced by the select.
        FromReferenceNode aliasRefNode = ( FromReferenceNode ) node;
View Full Code Here

TOP

Related Classes of org.hibernate.hql.internal.ast.tree.DotNode

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.