Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.hql.ast
Class HqlSqlWalker

    java.lang.Object
      antlr.TreeParser
          org.hibernate.hql.antlr.HqlSqlBaseWalker
              org.hibernate.hql.ast.HqlSqlWalker

All Implemented Interfaces:
  ParameterBinder.NamedParameterSource, HqlSqlTokenTypes, ErrorReporter

    public class HqlSqlWalker

extends HqlSqlBaseWalker
implements ErrorReporter, ParameterBinder.NamedParameterSource

Implements methods used by the HQL->SQL tree transform grammar (a.k.a. the second phase).

- Isolates the Hibernate API-specific code from the ANTLR generated code.
- Handles the SQL framgents generated by the persisters in order to create the SELECT and FROM clauses, taking into account the joins and projections that are implied by the mappings (persister/queryable).
- Uses SqlASTFactory to create customized AST nodes.

See Also:
  `SqlASTFactory`

Field Summary

Fields inherited from class org.hibernate.hql.antlr.HqlSqlBaseWalker
`_tokenNames, _tokenSet_0`

Fields inherited from class antlr.TreeParser
`_retTree, astFactory, ASTNULL, inputState, returnAST, tokenNames, traceDepth`

Fields inherited from interface org.hibernate.hql.antlr.HqlSqlTokenTypes
`AGGREGATE, ALIAS, ALIAS_REF, ALL, AND, ANY, AS, ASCENDING, AVG, BETWEEN, BOGUS, BOTH, CASE, CASE2, CLASS, CLOSE, CLOSE_BRACKET, COLON, COMMA, CONCAT, CONSTANT, CONSTRUCTOR, COUNT, DELETE, DESCENDING, DISTINCT, DIV, DOT, ELEMENTS, ELSE, EMPTY, END, EOF, EQ, ESCAPE, ESCqs, EXISTS, EXPONENT, EXPR_LIST, FALSE, FETCH, FILTER_ENTITY, FILTERS, FLOAT_SUFFIX, FROM, FROM_FRAGMENT, FULL, GE, GROUP, GT, HAVING, HEX_DIGIT, ID_LETTER, ID_START_LETTER, IDENT, IMPLIED_FROM, IN, IN_LIST, INDEX_OP, INDICES, INNER, INSERT, INTO, IS, IS_NOT_NULL, IS_NULL, JAVA_CONSTANT, JOIN, JOIN_FRAGMENT, LE, LEADING, LEFT, LEFT_OUTER, LIKE, LITERAL_ascending, LITERAL_by, LITERAL_descending, LT, MAX, MEMBER, METHOD_CALL, METHOD_NAME, MIN, MINUS, NAMED_PARAM, NE, NEW, NOT, NOT_BETWEEN, NOT_IN, NOT_LIKE, NULL, NULL_TREE_LOOKAHEAD, NUM_DOUBLE, NUM_FLOAT, NUM_INT, NUM_LONG, OBJECT, OF, ON, OPEN, OPEN_BRACKET, OR, ORDER, ORDER_ELEMENT, OUTER, PARAM, PLUS, PROPERTIES, PROPERTY_REF, QUERY, QUOTED_STRING, RANGE, RIGHT, RIGHT_OUTER, ROW_STAR, SELECT, SELECT_CLAUSE, SELECT_COLUMNS, SELECT_EXPR, SELECT_FROM, SET, SOME, SQL_NE, SQL_TOKEN, STAR, SUM, THEN, THETA_JOINS, TRAILING, TRUE, UNARY_MINUS, UNARY_PLUS, UNION, UPDATE, VECTOR_EXPR, VERSIONED, WEIRD_IDENT, WHEN, WHERE, WITH, WS`

Constructor Summary
`HqlSqlWalker(QueryTranslatorImpl qti, SessionFactoryImplementor sfi, HqlParser parser, Map tokenReplacements, String collectionRole)` Create a new tree transformer.

Method Summary
`void` | `addQuerySpaces(Serializable[] spaces)`
`protected void` | `beforeSelectClause()`
`protected antlr.collections.AST` | `createFromElement(String path, antlr.collections.AST alias, antlr.collections.AST propertyFetch)`
`protected antlr.collections.AST` | `createFromFilterElement(antlr.collections.AST filterEntity, antlr.collections.AST alias)`
`protected void` | `createFromJoinElement(antlr.collections.AST path, antlr.collections.AST alias, int joinType, antlr.collections.AST fetchNode, antlr.collections.AST propertyFetch, antlr.collections.AST with)`
`protected antlr.collections.AST` | `createIntoClause(String path, antlr.collections.AST propertySpec)`
`protected void` | `evaluateAssignment(antlr.collections.AST eq)`
`protected antlr.collections.AST` | `generateNamedParameter(antlr.collections.AST delimiterNode, antlr.collections.AST nameNode)`
`protected antlr.collections.AST` | `generatePositionalParameter(antlr.collections.AST inputNode)`
`AliasGenerator` | `getAliasGenerator()`
`ArrayList` | `getAssignmentSpecifications()`
`ASTPrinter` | `getASTPrinter()`
`FromClause` | `getCurrentFromClause()`
`Map` | `getEnabledFilters()`
`FromClause` | `getFinalFromClause()`
`int` | `getImpliedJoinType()`
`LiteralProcessor` | `getLiteralProcessor()`
`int[]` | `getNamedParameterLocations(String name)` Returns the locations of all occurrences of the named parameter.
`int` | `getNumberOfParametersInSetClause()`
`ArrayList` | `getParameters()`
`ParseErrorHandler` | `getParseErrorHandler()`
`Set` | `getQuerySpaces()` Returns the set of unique query spaces (a.k.a.
`String[]` | `getReturnAliases()`
`Type[]` | `getReturnTypes()`
`SelectClause` | `getSelectClause()`
`SessionFactoryHelper` | `getSessionFactoryHelper()`
`Map` | `getTokenReplacements()`
`boolean` | `isFilter()`
`protected boolean` | `isNonQualifiedPropertyRef(antlr.collections.AST ident)`
`boolean` | `isShallowQuery()`
`protected void` | `lookupAlias(antlr.collections.AST aliasRef)`
`protected antlr.collections.AST` | `lookupNonQualifiedProperty(antlr.collections.AST property)`
`protected antlr.collections.AST` | `lookupProperty(antlr.collections.AST dot, boolean root, boolean inSelect)`
`static void` | `panic()`
`protected void` | `postProcessDelete(antlr.collections.AST delete)`
`protected void` | `postProcessDML(RestrictableStatement statement)`
`protected void` | `postProcessInsert(antlr.collections.AST insert)`
`protected void` | `postProcessUpdate(antlr.collections.AST update)`
`protected void` | `prepareArithmeticOperator(antlr.collections.AST operator)`
`protected void` | `prepareFromClauseInputTree(antlr.collections.AST fromClauseInput)` Pre-process the from clause input tree.
`protected void` | `prepareLogicOperator(antlr.collections.AST operator)`
`protected void` | `prepareVersioned(antlr.collections.AST updateNode, antlr.collections.AST versioned)`
`protected void` | `processBoolean(antlr.collections.AST constant)`
`protected void` | `processConstant(antlr.collections.AST constant)`
`protected void` | `processConstructor(antlr.collections.AST constructor)`
`protected void` | `processFunction(antlr.collections.AST functionCall, boolean inSelect)`
`protected void` | `processIndex(antlr.collections.AST indexOp)`
`protected void` | `processNumericLiteral(antlr.collections.AST literal)`
`protected void` | `processQuery(antlr.collections.AST select, antlr.collections.AST query)`
`protected void` | `pushFromClause(antlr.collections.AST fromNode, antlr.collections.AST inputFromNode)` Sets the current 'FROM' context.
`void` | `reportError(antlr.RecognitionException e)`
`void` | `reportError(String s)`
`void` | `reportWarning(String s)`
`protected void` | `resolve(antlr.collections.AST node)`
`protected void` | `resolveSelectExpression(antlr.collections.AST node)`
`protected void` | `setAlias(antlr.collections.AST selectExpr, antlr.collections.AST ident)`
`protected void` | `setImpliedJoinType(int joinType)`
`static boolean` | `supportsIdGenWithBulkInsertion(IdentifierGenerator generator)`

Methods inherited from class org.hibernate.hql.antlr.HqlSqlBaseWalker
`addrExpr, addrExprLhs, aggregateExpr, aliasedSelectExpr, aliasRef, arithmeticExpr, assignment, caseExpr, collectionFunction, collectionFunctionOrSubselect, comparisonExpr, constant, constructor, count, deleteStatement, expr, exprOrSubquery, fromClause, fromElement, fromElementList, functionCall, getCurrentClauseType, getCurrentStatementType, getCurrentTopLevelClauseType, getStatementType, groupClause, identifier, inRhs, insertablePropertySpec, insertStatement, intoClause, isComparativeExpressionClause, isInCase, isInFrom, isInFunctionCall, isInSelect, isSelectStatement, isSubQuery, joinElement, joinType, literal, logicalExpr, newValue, numericInteger, orderClause, orderExprs, parameter, path, pathAsIdent, propertyName, propertyRef, propertyRefLhs, query, selectClause, selectExpr, selectExprList, selectStatement, setClause, statement, updateStatement, whereClause, withClause`

Methods inherited from class antlr.TreeParser
`getAST, getASTFactory, getTokenName, getTokenNames, match, match, matchNot, setASTFactory, setASTNodeClass, setASTNodeType, traceIn, traceIndent, traceOut`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HqlSqlWalker

    public HqlSqlWalker(QueryTranslatorImpl qti,
                        SessionFactoryImplementor sfi,
                        HqlParser parser,
                        Map tokenReplacements,
                        String collectionRole)

  Create a new tree transformer.

  Parameters:
    `qti` - Back pointer to the query translator implementation that is using this tree transform.
    `sfi` - The session factory implementor where the Hibernate mappings can be found.
    `parser` - A reference to the phase-1 parser
    `tokenReplacements` - Registers the token replacement map with the walker. This map will be used to substitute function names and constants.
    `collectionRole` - The collection role name of the collection used as the basis for the filter, NULL if this is not a collection filter compilation.

Method Detail

### prepareFromClauseInputTree

    protected void prepareFromClauseInputTree(antlr.collections.AST fromClauseInput)

  Description copied from class: `HqlSqlBaseWalker`
  Pre-process the from clause input tree.

  Overrides:
    `prepareFromClauseInputTree` in class `HqlSqlBaseWalker`

### isFilter

    public boolean isFilter()

### getSessionFactoryHelper

    public SessionFactoryHelper getSessionFactoryHelper()

### getTokenReplacements

    public Map getTokenReplacements()

### getAliasGenerator

    public AliasGenerator getAliasGenerator()

### getCurrentFromClause

    public FromClause getCurrentFromClause()

### getParseErrorHandler

    public ParseErrorHandler getParseErrorHandler()

### reportError

    public void reportError(antlr.RecognitionException e)

  Specified by:
    `reportError` in interface `ErrorReporter`
  Overrides:
    `reportError` in class `antlr.TreeParser`

### reportError

    public void reportError(String s)

  Specified by:
    `reportError` in interface `ErrorReporter`
  Overrides:
    `reportError` in class `antlr.TreeParser`

### reportWarning

    public void reportWarning(String s)

  Specified by:
    `reportWarning` in interface `ErrorReporter`
  Overrides:
    `reportWarning` in class `antlr.TreeParser`

### getQuerySpaces

    public Set getQuerySpaces()

  Returns the set of unique query spaces (a.k.a. table names) that occurred in the query.

  Returns:
    A set of table names (Strings).

### createFromElement

    protected antlr.collections.AST createFromElement(String path,
                                                      antlr.collections.AST alias,
                                                      antlr.collections.AST propertyFetch)
                                               throws antlr.SemanticException

  Overrides:
    `createFromElement` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### createFromFilterElement

    protected antlr.collections.AST createFromFilterElement(antlr.collections.AST filterEntity,
                                                            antlr.collections.AST alias)
                                                     throws antlr.SemanticException

  Overrides:
    `createFromFilterElement` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### createFromJoinElement

    protected void createFromJoinElement(antlr.collections.AST path,
                                         antlr.collections.AST alias,
                                         int joinType,
                                         antlr.collections.AST fetchNode,
                                         antlr.collections.AST propertyFetch,
                                         antlr.collections.AST with)
                                  throws antlr.SemanticException

  Overrides:
    `createFromJoinElement` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### pushFromClause

    protected void pushFromClause(antlr.collections.AST fromNode,
                                  antlr.collections.AST inputFromNode)

  Sets the current 'FROM' context.

  Overrides:
    `pushFromClause` in class `HqlSqlBaseWalker`
  Parameters:
    `fromNode` - The new 'FROM' context.
    `inputFromNode` - The from node from the input AST.

### lookupAlias

    protected void lookupAlias(antlr.collections.AST aliasRef)
                        throws antlr.SemanticException

  Overrides:
    `lookupAlias` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### setImpliedJoinType

    protected void setImpliedJoinType(int joinType)

  Overrides:
    `setImpliedJoinType` in class `HqlSqlBaseWalker`

### getImpliedJoinType

    public int getImpliedJoinType()

### lookupProperty

    protected antlr.collections.AST lookupProperty(antlr.collections.AST dot,
                                                   boolean root,
                                                   boolean inSelect)
                                            throws antlr.SemanticException

  Overrides:
    `lookupProperty` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### isNonQualifiedPropertyRef

    protected boolean isNonQualifiedPropertyRef(antlr.collections.AST ident)

  Overrides:
    `isNonQualifiedPropertyRef` in class `HqlSqlBaseWalker`

### lookupNonQualifiedProperty

    protected antlr.collections.AST lookupNonQualifiedProperty(antlr.collections.AST property)
                                                        throws antlr.SemanticException

  Overrides:
    `lookupNonQualifiedProperty` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### processQuery

    protected void processQuery(antlr.collections.AST select,
                                antlr.collections.AST query)
                         throws antlr.SemanticException

  Overrides:
    `processQuery` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### postProcessDML

    protected void postProcessDML(RestrictableStatement statement)
                           throws antlr.SemanticException

  Throws:
    `antlr.SemanticException`

### postProcessUpdate

    protected void postProcessUpdate(antlr.collections.AST update)
                              throws antlr.SemanticException

  Overrides:
    `postProcessUpdate` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### postProcessDelete

    protected void postProcessDelete(antlr.collections.AST delete)
                              throws antlr.SemanticException

  Overrides:
    `postProcessDelete` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### supportsIdGenWithBulkInsertion

    public static boolean supportsIdGenWithBulkInsertion(IdentifierGenerator generator)

### postProcessInsert

    protected void postProcessInsert(antlr.collections.AST insert)
                              throws antlr.SemanticException,
                                     QueryException

  Overrides:
    `postProcessInsert` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`
    `QueryException`

### resolve

    protected void resolve(antlr.collections.AST node)
                    throws antlr.SemanticException

  Overrides:
    `resolve` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### resolveSelectExpression

    protected void resolveSelectExpression(antlr.collections.AST node)
                                    throws antlr.SemanticException

  Overrides:
    `resolveSelectExpression` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### beforeSelectClause

    protected void beforeSelectClause()
                               throws antlr.SemanticException

  Overrides:
    `beforeSelectClause` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### generatePositionalParameter

    protected antlr.collections.AST generatePositionalParameter(antlr.collections.AST inputNode)
                                                         throws antlr.SemanticException

  Overrides:
    `generatePositionalParameter` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### generateNamedParameter

    protected antlr.collections.AST generateNamedParameter(antlr.collections.AST delimiterNode,
                                                           antlr.collections.AST nameNode)
                                                    throws antlr.SemanticException

  Overrides:
    `generateNamedParameter` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### processConstant

    protected void processConstant(antlr.collections.AST constant)
                            throws antlr.SemanticException

  Overrides:
    `processConstant` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### processBoolean

    protected void processBoolean(antlr.collections.AST constant)
                           throws antlr.SemanticException

  Overrides:
    `processBoolean` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### processNumericLiteral

    protected void processNumericLiteral(antlr.collections.AST literal)

  Overrides:
    `processNumericLiteral` in class `HqlSqlBaseWalker`

### processIndex

    protected void processIndex(antlr.collections.AST indexOp)
                         throws antlr.SemanticException

  Overrides:
    `processIndex` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### processFunction

    protected void processFunction(antlr.collections.AST functionCall,
                                   boolean inSelect)
                            throws antlr.SemanticException

  Overrides:
    `processFunction` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### processConstructor

    protected void processConstructor(antlr.collections.AST constructor)
                               throws antlr.SemanticException

  Overrides:
    `processConstructor` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### setAlias

    protected void setAlias(antlr.collections.AST selectExpr,
                            antlr.collections.AST ident)

  Overrides:
    `setAlias` in class `HqlSqlBaseWalker`

### getNamedParameterLocations

    public int[] getNamedParameterLocations(String name)
                                     throws QueryException

  Returns the locations of all occurrences of the named parameter.

  Specified by:
    `getNamedParameterLocations` in interface `ParameterBinder.NamedParameterSource`
  Throws:
    `QueryException`

### addQuerySpaces

    public void addQuerySpaces(Serializable[] spaces)

### getReturnTypes

    public Type[] getReturnTypes()

### getReturnAliases

    public String[] getReturnAliases()

### getSelectClause

    public SelectClause getSelectClause()

### getFinalFromClause

    public FromClause getFinalFromClause()

### isShallowQuery

    public boolean isShallowQuery()

### getEnabledFilters

    public Map getEnabledFilters()

### getLiteralProcessor

    public LiteralProcessor getLiteralProcessor()

### getASTPrinter

    public ASTPrinter getASTPrinter()

### getParameters

    public ArrayList getParameters()

### getNumberOfParametersInSetClause

    public int getNumberOfParametersInSetClause()

### evaluateAssignment

    protected void evaluateAssignment(antlr.collections.AST eq)
                               throws antlr.SemanticException

  Overrides:
    `evaluateAssignment` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### getAssignmentSpecifications

    public ArrayList getAssignmentSpecifications()

### createIntoClause

    protected antlr.collections.AST createIntoClause(String path,
                                                     antlr.collections.AST propertySpec)
                                              throws antlr.SemanticException

  Overrides:
    `createIntoClause` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### prepareVersioned

    protected void prepareVersioned(antlr.collections.AST updateNode,
                                    antlr.collections.AST versioned)
                             throws antlr.SemanticException

  Overrides:
    `prepareVersioned` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### prepareLogicOperator

    protected void prepareLogicOperator(antlr.collections.AST operator)
                                 throws antlr.SemanticException

  Overrides:
    `prepareLogicOperator` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### prepareArithmeticOperator

    protected void prepareArithmeticOperator(antlr.collections.AST operator)
                                      throws antlr.SemanticException

  Overrides:
    `prepareArithmeticOperator` in class `HqlSqlBaseWalker`
  Throws:
    `antlr.SemanticException`

### panic

    public static void panic()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD