Examples of FromElement


Examples of org.hibernate.hql.ast.tree.FromElement

      String withClauseJoinAlias = visitor.getJoinAlias();
      if ( withClauseJoinAlias == null ) {
        withClauseJoinAlias = fromElement.getCollectionTableAlias();
      }
      else {
        FromElement referencedFromElement = visitor.getReferencedFromElement();
        if ( referencedFromElement != fromElement ) {
          throw new InvalidWithClauseException( "with-clause expressions did not reference from-clause element to which the with-clause was associated" );
        }
      }
View Full Code Here

Examples of org.hibernate.hql.ast.tree.FromElement

    currentFromClause = currentFromClause.getParentFromClause();
  }

  protected void lookupAlias(AST aliasRef)
      throws SemanticException {
    FromElement alias = currentFromClause.getFromElement( aliasRef.getText() );
    FromReferenceNode aliasRefNode = ( FromReferenceNode ) aliasRef;
    aliasRefNode.setFromElement( alias );
  }
View Full Code Here

Examples of org.hibernate.hql.ast.tree.FromElement

      return false;
    }

    List fromElements = currentFromClause.getExplicitFromElements();
    if ( fromElements.size() == 1 ) {
      final FromElement fromElement = ( FromElement ) fromElements.get( 0 );
      try {
        if( trace ) log.trace( "attempting to resolve property [" + identText + "] as a non-qualified ref" );
        return fromElement.getPropertyMapping( identText ).toType( identText ) != null;
      }
      catch( QueryException e ) {
        // Should mean that no such property was found
      }
    }
View Full Code Here

Examples of org.hibernate.hql.ast.tree.FromElement

    return false;
  }

  protected AST lookupNonQualifiedProperty(AST property) throws SemanticException {
    final FromElement fromElement = ( FromElement ) currentFromClause.getExplicitFromElements().get( 0 );
    AST syntheticDotNode = generateSyntheticDotNodeForNonQualifiedPropertyRef( property, fromElement );
    return lookupProperty( syntheticDotNode, false, getCurrentClauseType() == HqlSqlTokenTypes.SELECT );
  }
View Full Code Here

Examples of org.hibernate.hql.ast.tree.FromElement

      joinProcessor.processJoins( qn );

      // Attach any mapping-defined "ORDER BY" fragments
      Iterator itr = qn.getFromClause().getProjectionList().iterator();
      while ( itr.hasNext() ) {
        final FromElement fromElement = ( FromElement ) itr.next();
//      if ( fromElement.isFetch() && fromElement.isCollectionJoin() ) {
        if ( fromElement.isFetch() && fromElement.getQueryableCollection() != null ) {
          // Does the collection referenced by this FromElement
          // specify an order-by attribute?  If so, attach it to
          // the query's order-by
          if ( fromElement.getQueryableCollection().hasOrdering() ) {
            String orderByFragment = fromElement
                .getQueryableCollection()
                .getSQLOrderByString( fromElement.getCollectionTableAlias() );
            qn.getOrderByClause().addOrderFragment( orderByFragment );
          }
          if ( fromElement.getQueryableCollection().hasManyToManyOrdering() ) {
            String orderByFragment = fromElement.getQueryableCollection()
                .getManyToManyOrderByString( fromElement.getTableAlias() );
            qn.getOrderByClause().addOrderFragment( orderByFragment );
          }
        }
      }
    }
View Full Code Here

Examples of org.hibernate.hql.ast.tree.FromElement

  }

  protected void postProcessDML(RestrictableStatement statement) throws SemanticException {
    statement.getFromClause().resolve();

    FromElement fromElement = ( FromElement ) statement.getFromClause().getFromElements().get( 0 );
    Queryable persister = fromElement.getQueryable();
    // Make #@%$^#^&# sure no alias is applied to the table name
    fromElement.setText( persister.getTableName() );

//    // append any filter fragments; the EMPTY_MAP is used under the assumption that
//    // currently enabled filters should not affect this process
//    if ( persister.getDiscriminatorType() != null ) {
//      new SyntheticAndFactory( getASTFactory() ).addDiscriminatorWhereFragment(
//              statement,
//              persister,
//              java.util.Collections.EMPTY_MAP,
//              fromElement.getTableAlias()
//      );
//    }
    if ( persister.getDiscriminatorType() != null || ! queryTranslatorImpl.getEnabledFilters().isEmpty() ) {
      new SyntheticAndFactory( this ).addDiscriminatorWhereFragment(
              statement,
              persister,
              queryTranslatorImpl.getEnabledFilters(),
              fromElement.getTableAlias()
      );
    }

  }
View Full Code Here

Examples of org.hibernate.hql.ast.tree.FromElement

      case ALIAS_REF:
        // Notify the FROM element that it is being referenced by the select.
        FromReferenceNode aliasRefNode = ( FromReferenceNode ) node;
        //aliasRefNode.resolve( false, false, aliasRefNode.getText() ); //TODO: is it kosher to do it here?
        aliasRefNode.resolve( false, false ); //TODO: is it kosher to do it here?
        FromElement fromElement = aliasRefNode.getFromElement();
        if ( fromElement != null ) {
          fromElement.setIncludeSubclasses( true );
        }
      default:
        break;
    }
  }
View Full Code Here

Examples of org.hibernate.hql.ast.tree.FromElement

  protected void beforeSelectClause() throws SemanticException {
    // Turn off includeSubclasses on all FromElements.
    FromClause from = getCurrentFromClause();
    List fromElements = from.getFromElements();
    for ( Iterator iterator = fromElements.iterator(); iterator.hasNext(); ) {
      FromElement fromElement = ( FromElement ) iterator.next();
      fromElement.setIncludeSubclasses( false );
    }
  }
View Full Code Here

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

      //          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

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

    return querySpaces;
  }

  @Override
  protected AST createFromElement(String path, AST alias, AST propertyFetch) throws SemanticException {
    FromElement fromElement = currentFromClause.addFromElement( path, alias );
    fromElement.setAllPropertyFetch( propertyFetch != null );
    return fromElement;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.