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.QueryTranslator
          org.apache.cayenne.access.trans.QueryAssembler

Direct Known Subclasses:
  DeleteTranslator, SelectTranslator, UpdateTranslator

    public abstract class QueryAssembler

extends QueryTranslator

Abstract superclass of Query translators.

Author:
  Andrus Adamchik

Field Summary
`protected List<DbAttribute>` | `attributes` PreparedStatement attributes matching entries in `values` list.
`protected List<Object>` | `values` Holds PreparedStatement values.

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

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.
`abstract String` | `getCurrentAlias()` Returns an alias of the table which is currently at the top of the join stack.
`protected Map<String,String>` | `getPathAliases()` Returns aliases for the path splits defined in the query.
`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.
`boolean` | `supportsTableAliases()` Returns `true` if table aliases are supported.

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

### values

    protected List<Object> values

  Holds PreparedStatement values.

### attributes

    protected List<DbAttribute> attributes

  PreparedStatement attributes matching entries in `values` 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

### 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.

  Specified by:
    `createStatement` in class `QueryTranslator`
  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-2008 Apache Cayenne. All Rights Reserved.