org.hibernate.hql.ast.tree
Class QueryNode

java.lang.Object
  extended by antlr.BaseAST
      extended by antlr.CommonAST
          extended by org.hibernate.hql.ast.tree.Node
              extended by org.hibernate.hql.ast.tree.SqlNode
                  extended by org.hibernate.hql.ast.tree.HqlSqlWalkerNode
                      extended by org.hibernate.hql.ast.tree.AbstractStatement
                          extended by org.hibernate.hql.ast.tree.AbstractRestrictableStatement
                              extended by org.hibernate.hql.ast.tree.QueryNode
All Implemented Interfaces:
antlr.collections.AST, Serializable, InitializeableNode, RestrictableStatement, SelectExpression, Statement, DisplayableNode

public class QueryNode
extends AbstractRestrictableStatement
implements SelectExpression

Defines a top-level AST node representing an HQL select statement.

Author:
Joshua Davis
See Also:
Serialized Form

Field Summary
 
Fields inherited from class antlr.BaseAST
down, right
 
Constructor Summary
QueryNode()
           
 
Method Summary
 String getAlias()
           
 Type getDataType()
          Returns the data type of the select expression.
 FromElement getFromElement()
          Returns the FROM element that this expression refers to.
protected  org.slf4j.Logger getLog()
           
 OrderByClause getOrderByClause()
           
 SelectClause getSelectClause()
          Locate the select clause that is part of this select statement.
 int getStatementType()
          Return the main token type representing the type of this statement.
protected  int getWhereClauseParentTokenType()
           
 boolean hasOrderByClause()
           
 boolean isConstructor()
          Returns true if the element is a constructor (e.g.
 boolean isReturnableEntity()
          Returns true if this select expression represents an entity that can be returned.
 boolean isScalar()
           
 boolean needsExecutor()
          Does this statement require the StatementExecutor?
 void setAlias(String alias)
           
 void setScalarColumnText(int i)
          Appends AST nodes that represent the columns after the current AST node.
 
Methods inherited from class org.hibernate.hql.ast.tree.AbstractRestrictableStatement
getFromClause, getWhereClause, hasWhereClause, locateWhereClause
 
Methods inherited from class org.hibernate.hql.ast.tree.AbstractStatement
getDisplayText
 
Methods inherited from class org.hibernate.hql.ast.tree.HqlSqlWalkerNode
getAliasGenerator, getASTFactory, getSessionFactoryHelper, getWalker, initialize
 
Methods inherited from class org.hibernate.hql.ast.tree.SqlNode
getOriginalText, setDataType, setText
 
Methods inherited from class org.hibernate.hql.ast.tree.Node
getColumn, getFilename, getLine, getRenderText, getTextLength, initialize, initialize
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, setType
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, getNumberOfChildren, getTokenNames, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toString, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.hibernate.hql.ast.tree.SelectExpression
setText
 
Methods inherited from interface org.hibernate.hql.ast.tree.Statement
getWalker
 

Constructor Detail

QueryNode

public QueryNode()
Method Detail

getStatementType

public int getStatementType()
Description copied from interface: Statement
Return the main token type representing the type of this statement.

Specified by:
getStatementType in interface Statement
Returns:
The corresponding token type.
See Also:
Statement.getStatementType()

needsExecutor

public boolean needsExecutor()
Description copied from interface: Statement
Does this statement require the StatementExecutor?

Essentially, at the JDBC level, does this require an executeUpdate()?

Specified by:
needsExecutor in interface Statement
Returns:
True if this statement should be handed off to the StatementExecutor to be executed; false otherwise.
See Also:
Statement.needsExecutor()

getWhereClauseParentTokenType

protected int getWhereClauseParentTokenType()
Specified by:
getWhereClauseParentTokenType in class AbstractRestrictableStatement

getLog

protected org.slf4j.Logger getLog()
Specified by:
getLog in class AbstractRestrictableStatement

getSelectClause

public final SelectClause getSelectClause()
Locate the select clause that is part of this select statement.

Note, that this might return null as derived select clauses (i.e., no select clause at the HQL-level) get generated much later than when we get created; thus it depends upon lifecycle.

Returns:
Our select clause, or null.

hasOrderByClause

public final boolean hasOrderByClause()

getOrderByClause

public final OrderByClause getOrderByClause()

getAlias

public String getAlias()
Specified by:
getAlias in interface SelectExpression

getFromElement

public FromElement getFromElement()
Description copied from interface: SelectExpression
Returns the FROM element that this expression refers to.

Specified by:
getFromElement in interface SelectExpression
Returns:
The FROM element.

isConstructor

public boolean isConstructor()
Description copied from interface: SelectExpression
Returns true if the element is a constructor (e.g. new Foo).

Specified by:
isConstructor in interface SelectExpression
Returns:
true if the element is a constructor (e.g. new Foo).

isReturnableEntity

public boolean isReturnableEntity()
                           throws antlr.SemanticException
Description copied from interface: SelectExpression
Returns true if this select expression represents an entity that can be returned.

Specified by:
isReturnableEntity in interface SelectExpression
Returns:
true if this select expression represents an entity that can be returned.
Throws:
antlr.SemanticException

isScalar

public boolean isScalar()
                 throws antlr.SemanticException
Specified by:
isScalar in interface SelectExpression
Throws:
antlr.SemanticException

setAlias

public void setAlias(String alias)
Specified by:
setAlias in interface SelectExpression

setScalarColumnText

public void setScalarColumnText(int i)
                         throws antlr.SemanticException
Description copied from interface: SelectExpression
Appends AST nodes that represent the columns after the current AST node. (e.g. 'as col0_O_')

Specified by:
setScalarColumnText in interface SelectExpression
Parameters:
i - The index of the select expression in the projection list.
Throws:
antlr.SemanticException

getDataType

public Type getDataType()
Description copied from interface: SelectExpression
Returns the data type of the select expression.

Specified by:
getDataType in interface SelectExpression
Overrides:
getDataType in class SqlNode
Returns:
The data type of the select expression.


Copyright © null-null Red Hat Middleware, LLC. All Rights Reserved