org.hibernate.hql.ast.tree

Class QueryNode

Implemented Interfaces:
DisplayableNode, InitializeableNode, RestrictableStatement, SelectExpression, Statement

public class QueryNode
extends AbstractRestrictableStatement
implements SelectExpression

Defines a top-level AST node representing an HQL select statement.
Author:
Joshua Davis

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 Logger
getLog()
OrderByClause
getOrderByClause()
SelectClause
getSelectClause()
Locate the select clause that is part of this select statement.
int
getStatementType()
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()
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, getLog, getWhereClause, getWhereClauseParentTokenType, hasWhereClause, locateWhereClause

Methods inherited from class org.hibernate.hql.ast.tree.AbstractStatement

getDisplayText

Methods inherited from class org.hibernate.hql.ast.tree.HqlSqlWalkerNode

getASTFactory, getAliasGenerator, getSessionFactoryHelper, getWalker, initialize

Methods inherited from class org.hibernate.hql.ast.tree.SqlNode

getDataType, getOriginalText, setDataType, setText

Methods inherited from class org.hibernate.hql.ast.tree.Node

getColumn, getFilename, getLine, getRenderText, getTextLength, initialize, initialize

Method Details

getAlias

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

getDataType

public Type getDataType()
Returns the data type of the select expression.
Specified by:
getDataType in interface SelectExpression
Overrides:
getDataType in interface SqlNode
Returns:
The data type of the select expression.

getFromElement

public FromElement getFromElement()
Returns the FROM element that this expression refers to.
Specified by:
getFromElement in interface SelectExpression
Returns:
The FROM element.

getLog

protected Logger getLog()
Overrides:
getLog in interface AbstractRestrictableStatement

getOrderByClause

public final OrderByClause getOrderByClause()

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.

getStatementType

public int getStatementType()
Specified by:
getStatementType in interface Statement

getWhereClauseParentTokenType

protected int getWhereClauseParentTokenType()
Overrides:
getWhereClauseParentTokenType in interface AbstractRestrictableStatement

hasOrderByClause

public final boolean hasOrderByClause()

isConstructor

public boolean isConstructor()
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 SemanticException
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.

isScalar

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

needsExecutor

public boolean needsExecutor()
Specified by:
needsExecutor in interface Statement

setAlias

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

setScalarColumnText

public void setScalarColumnText(int i)
            throws SemanticException
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.