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 QueryAssembler

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

Direct Known Subclasses:
  DeleteTranslator, SelectTranslator, UpdateTranslator

    public abstract class QueryAssembler

extends Object

Abstract superclass of Query translators.

Field Summary
`protected DbAdapter` | `adapter`
`protected List<DbAttribute>` | `attributes` PreparedStatement attributes matching entries in `values` list.
`protected Connection` | `connection`
`protected EntityResolver` | `entityResolver`
`protected int` | `parameterIndex` The index parameter will be inserted at in parameter list
`protected Query` | `query`
`protected QueryMetadata` | `queryMetadata`
`protected List<Object>` | `values` Holds PreparedStatement values.

Constructor Summary
`QueryAssembler()`

Method Summary
`void` | `addToParamList(DbAttribute dbAttr, Object anObject)` Registers `anObject` as a PreparedStatement parameter.
`abstract String` | `createSqlString()` Translates query into sql string.
`PreparedStatement` | `createStatement()` Translates internal query into PreparedStatement.
`abstract void` | `dbRelationshipAdded(DbRelationship relationship, JoinType joinType, String joinSplitAlias)` Appends a join with given semantics to the query.
`DbAdapter` | `getAdapter()`
`abstract String` | `getCurrentAlias()` Returns an alias of the table which is currently at the top of the join stack.
`EntityResolver` | `getEntityResolver()`
`protected Map<String,String>` | `getPathAliases()` Returns aliases for the path splits defined in the query.
`Query` | `getQuery()` Returns query object being processed.
`QueryMetadata` | `getQueryMetadata()`
`DbEntity` | `getRootDbEntity()`
`ObjEntity` | `getRootEntity()`
`EntityInheritanceTree` | `getRootInheritanceTree()` Returns an EntityInheritanceTree for the root entity.
`protected void` | `initStatement(PreparedStatement stmt)` Initializes prepared statements with collected parameters.
`abstract void` | `resetJoinStack()` A callback invoked by a child qualifier or ordering processor allowing query assembler to reset its join stack.
`void` | `setAdapter(DbAdapter adapter)`
`void` | `setConnection(Connection connection)`
`void` | `setEntityResolver(EntityResolver entityResolver)`
`void` | `setQuery(Query query)`
`boolean` | `supportsTableAliases()` Returns `true` if table aliases are supported.

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

Field Detail

### query

    protected Query query

### queryMetadata

    protected QueryMetadata queryMetadata

### connection

    protected Connection connection

### adapter

    protected DbAdapter adapter

### entityResolver

    protected EntityResolver entityResolver

### values

    protected List<Object> values

  Holds PreparedStatement values.

### attributes

    protected List<DbAttribute> attributes

  PreparedStatement attributes matching entries in `values` list.

### parameterIndex

    protected int parameterIndex

  The index parameter will be inserted at in parameter list

Constructor Detail

### QueryAssembler

    public QueryAssembler()

Method Detail

### getPathAliases

    protected Map<String,String> getPathAliases()

  Returns aliases for the path splits defined in the query.

  Since:
    3.0

### getEntityResolver

    public EntityResolver getEntityResolver()

### getAdapter

    public DbAdapter getAdapter()

### getRootInheritanceTree

    public EntityInheritanceTree getRootInheritanceTree()

  Returns an EntityInheritanceTree for the root entity.

  Since:
    1.1

### getQuery

    public Query getQuery()

  Returns query object being processed.

### getQueryMetadata

    public QueryMetadata getQueryMetadata()

### setQuery

    public void setQuery(Query query)

### setConnection

    public void setConnection(Connection connection)

### setAdapter

    public void setAdapter(DbAdapter adapter)

### setEntityResolver

    public void setEntityResolver(EntityResolver entityResolver)

### getRootDbEntity

    public DbEntity getRootDbEntity()

### getRootEntity

    public ObjEntity getRootEntity()

### resetJoinStack

    public abstract void resetJoinStack()

  A callback invoked by a child qualifier or ordering processor allowing query assembler to reset its join stack.

  Since:
    3.0

### getCurrentAlias

    public abstract String getCurrentAlias()

  Returns an alias of the table which is currently at the top of the join stack.

  Since:
    3.0

### dbRelationshipAdded

    public abstract void dbRelationshipAdded(DbRelationship relationship,
                                             JoinType joinType,
                                             String joinSplitAlias)

  Appends a join with given semantics to the query.

  Since:
    3.0

### createSqlString

    public abstract String createSqlString()
                                    throws Exception

  Translates query into sql string. This is a workhorse method of QueryAssembler. It is called internally from `createStatement`. Usually there is no need to invoke it explicitly.

  Throws:
    `Exception`

### supportsTableAliases

    public boolean supportsTableAliases()

  Returns `true` if table aliases are supported. Default implementation returns false.

### addToParamList

    public void addToParamList(DbAttribute dbAttr,
                               Object anObject)

  Registers `anObject` as a PreparedStatement parameter.

  Parameters:
    `anObject` - object that represents a value of DbAttribute
    `dbAttr` - DbAttribute being processed.

### createStatement

    public PreparedStatement createStatement()
                                      throws Exception

  Translates internal query into PreparedStatement.

  Throws:
    `Exception`

### initStatement

    protected void initStatement(PreparedStatement stmt)
                          throws Exception

  Initializes prepared statements with collected parameters. Called internally from "createStatement". Cayenne users shouldn't normally call it directly.

  Throws:
    `Exception`

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-2009 Apache Cayenne. All Rights Reserved.