Package org.apache.cayenne.access.translator.ejbql

## Class EJBQLTranslationContext

- java.lang.Object
- - org.apache.cayenne.access.translator.ejbql.EJBQLTranslationContext

-     public class EJBQLTranslationContext
      extends Object

  A context used for translating of EJBQL to SQL.
  Since:
    3.0

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected Map<String,​Object>` | `namedParameters` |
    `protected Map<Integer,​Object>` | `positionalParameters` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `EJBQLTranslationContext​(EntityResolver entityResolver, EJBQLQuery query, EJBQLCompiledExpression compiledExpression, EJBQLTranslatorFactory translatorFactory, QuotingStrategy quotingStrategy)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `EJBQLTranslationContext` | `append​(char chunk)` | Appends a piece of SQL to the internal buffer.
    `EJBQLTranslationContext` | `append​(String chunk)` | Appends a piece of SQL to the internal buffer.
    `ClassDescriptor` | `getEntityDescriptor​(String id)` | Looks up entity descriptor for an identifier that can be a compiled expression id or one of the aliases.
    `QueryMetadata` | `getMetadata()` |
    `SQLTemplate` | `getQuery()` |
    `QuotingStrategy` | `getQuotingStrategy()` |
    `protected String` | `getTableAlias​(String idPath, String tableName)` | Retrieves a SQL alias for the combination of EJBQL id variable and a table name.
    `boolean` | `isAppendingResultColumns()` |
    `boolean` | `isCaseInsensitive()` |
    `boolean` | `isUsingAliases()` |
    `String` | `makeDistinctMarker()` |
    `void` | `onSubselect()` |
    `void` | `pushMarker​(String marker, boolean reset)` | Switches the current buffer to a marked buffer, pushing the currently used buffer on the stack.
    `void` | `setCaseInsensitive​(boolean caseInsensitive)` |
    `void` | `setUsingAliases​(boolean useAliases)` |

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### namedParameters

          protected Map<String,​Object> namedParameters

    - #### positionalParameters

          protected Map<Integer,​Object> positionalParameters

  - ### Constructor Detail

    - #### EJBQLTranslationContext

          public EJBQLTranslationContext​(EntityResolver entityResolver,
                                         EJBQLQuery query,
                                         EJBQLCompiledExpression compiledExpression,
                                         EJBQLTranslatorFactory translatorFactory,
                                         QuotingStrategy quotingStrategy)

  - ### Method Detail

    - #### getQuery

          public SQLTemplate getQuery()

    - #### getMetadata

          public QueryMetadata getMetadata()

    - #### getEntityDescriptor

          public ClassDescriptor getEntityDescriptor​(String id)

      Looks up entity descriptor for an identifier that can be a compiled expression id or one of the aliases.

    - #### pushMarker

          public void pushMarker​(String marker,
                                 boolean reset)

      Switches the current buffer to a marked buffer, pushing the currently used buffer on the stack. Note that this can be done even before the marker is inserted in the main buffer. If "reset" is true, any previous contents of the marker are cleared.

    - #### append

          public EJBQLTranslationContext append​(String chunk)

      Appends a piece of SQL to the internal buffer.

    - #### append

          public EJBQLTranslationContext append​(char chunk)

      Appends a piece of SQL to the internal buffer.

    - #### getTableAlias

          protected String getTableAlias​(String idPath,
                                         String tableName)

      Retrieves a SQL alias for the combination of EJBQL id variable and a table name. If such alias hasn't been used, it is created on the fly.

    - #### isAppendingResultColumns

          public boolean isAppendingResultColumns()

    - #### isUsingAliases

          public boolean isUsingAliases()

    - #### setUsingAliases

          public void setUsingAliases​(boolean useAliases)

    - #### isCaseInsensitive

          public boolean isCaseInsensitive()

    - #### setCaseInsensitive

          public void setCaseInsensitive​(boolean caseInsensitive)

    - #### getQuotingStrategy

          public QuotingStrategy getQuotingStrategy()

    - #### onSubselect

          public void onSubselect()

    - #### makeDistinctMarker

          public String makeDistinctMarker()