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.apache.cayenne.access.trans
Class SelectTranslator

    java.lang.Object
      org.apache.cayenne.access.QueryTranslator
          org.apache.cayenne.access.trans.QueryAssembler
              org.apache.cayenne.access.trans.SelectTranslator

Direct Known Subclasses:
  OracleSelectTranslator

    public class SelectTranslator

extends QueryAssembler

A builder of JDBC PreparedStatements based on Cayenne SelectQueries. Translates SelectQuery to parameterized SQL string and wraps it in a PreparedStatement. SelectTranslator is stateful and thread-unsafe.

Author:
  Andrus Adamchik

Field Summary
`protected static int[]` | `UNSUPPORTED_DISTINCT_TYPES`

Fields inherited from class org.apache.cayenne.access.trans.QueryAssembler
`attributes, values`

Fields inherited from class org.apache.cayenne.access.QueryTranslator
`adapter, connection, entityResolver, query`

Constructor Summary
`SelectTranslator()`

Method Summary
`String` | `aliasForTable(DbEntity ent)` Overrides superclass implementation.
`String` | `aliasForTable(DbEntity ent, DbRelationship rel)`
`String` | `createSqlString()` Returns query translated to SQL.
`void` | `dbRelationshipAdded(DbRelationship rel)` Stores a new relationship in an internal list.
`Map` | `getAttributeOverrides()` Returns a map of ColumnDescriptors keyed by ObjAttribute for columns that may need to be reprocessed manually due to incompatible mappings along the inheritance hierarchy.
`ColumnDescriptor[]` | `getResultColumns()` Returns a list of ColumnDescriptors for the query columns.
`boolean` | `isSuppressingDistinct()` Returns true if SelectTranslator determined that a query requiring DISTINCT can't be run with DISTINCT keyword for internal reasons.
`protected static boolean` | `isUnsupportedForDistinct(int type)`
`protected String` | `newAliasForTable(DbEntity ent)` Sets up and returns a new alias for a specified table.
`boolean` | `supportsTableAliases()` Always returns true.

Methods inherited from class org.apache.cayenne.access.trans.QueryAssembler
`addToParamList, createStatement, initStatement`

Methods inherited from class org.apache.cayenne.access.QueryTranslator
`getAdapter, getConnection, getEntityResolver, getQuery, getRootDbEntity, getRootEntity, getRootInheritanceTree, setAdapter, setConnection, setEntityResolver, setQuery`

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

Field Detail

### UNSUPPORTED_DISTINCT_TYPES

    protected static final int[] UNSUPPORTED_DISTINCT_TYPES

Constructor Detail

### SelectTranslator

    public SelectTranslator()

Method Detail

### isUnsupportedForDistinct

    protected static boolean isUnsupportedForDistinct(int type)

### createSqlString

    public String createSqlString()
                           throws Exception

  Returns query translated to SQL. This is a main work method of the SelectTranslator.

  Specified by:
    `createSqlString` in class `QueryAssembler`
  Throws:
    `Exception`

### getResultColumns

    public ColumnDescriptor[] getResultColumns()

  Returns a list of ColumnDescriptors for the query columns.

  Since:
    1.2

### getAttributeOverrides

    public Map getAttributeOverrides()

  Returns a map of ColumnDescriptors keyed by ObjAttribute for columns that may need to be reprocessed manually due to incompatible mappings along the inheritance hierarchy.

  Since:
    1.2

### isSuppressingDistinct

    public boolean isSuppressingDistinct()

  Returns true if SelectTranslator determined that a query requiring DISTINCT can't be run with DISTINCT keyword for internal reasons. If this method returns true, DataNode may need to do in-memory distinct filtering.

  Since:
    1.1

### dbRelationshipAdded

    public void dbRelationshipAdded(DbRelationship rel)

  Stores a new relationship in an internal list. Later it will be used to create joins to relationship destination table.

  Specified by:
    `dbRelationshipAdded` in class `QueryAssembler`

### newAliasForTable

    protected String newAliasForTable(DbEntity ent)

  Sets up and returns a new alias for a specified table.

### aliasForTable

    public String aliasForTable(DbEntity ent,
                                DbRelationship rel)

  Overrides:
    `aliasForTable` in class `QueryAssembler`

### aliasForTable

    public String aliasForTable(DbEntity ent)

  Overrides superclass implementation. Will return an alias that should be used for a specified DbEntity in the query (or null if this DbEntity is not included in the FROM clause).

  Specified by:
    `aliasForTable` in class `QueryAssembler`

### supportsTableAliases

    public boolean supportsTableAliases()

  Always returns true.

  Overrides:
    `supportsTableAliases` in class `QueryAssembler`

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

Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.