Class QueryAssembler
java.lang.Object
org.apache.cayenne.access.translator.select.QueryAssembler
- Direct Known Subclasses:
DefaultSelectTranslator
public abstract class QueryAssembler extends Object
Abstract superclass of Query translators.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interfaceQueryAssembler.AddBindingListener -
Field Summary
Fields Modifier and Type Field Description protected DbAdapteradapterprotected QueryAssembler.AddBindingListeneraddBindingListenerprotected List<DbAttributeBinding>bindingsprotected EntityResolverentityResolverprotected Queryqueryprotected QueryMetadataqueryMetadataprotected Stringsqlprotected booleantranslated -
Constructor Summary
Constructors Constructor Description QueryAssembler(Query query, DbAdapter adapter, EntityResolver entityResolver) -
Method Summary
Modifier and Type Method Description voidaddToParamList(DbAttribute dbAttr, Object anObject)RegistersanObjectas a PreparedStatement parameter.abstract voiddbRelationshipAdded(DbRelationship relationship, JoinType joinType, String joinSplitAlias)Appends a join with given semantics to the query.protected abstract voiddoTranslate()protected voidensureTranslated()DbAdaptergetAdapter()abstract StringgetAliasForExpression(Expression exp)DbAttributeBinding[]getBindings()abstract StringgetCurrentAlias()Returns an alias of the table which is currently at the top of the join stack.EntityResolvergetEntityResolver()protected Map<String,String>getPathAliases()Returns aliases for the path splits defined in the query.QuerygetQuery()Returns query object being processed.QueryMetadatagetQueryMetadata()StringgetSql()Translates query into an SQL string formatted to use in a PreparedStatement.abstract voidresetJoinStack()A callback invoked by a child qualifier or ordering processor allowing query assembler to reset its join stack.voidsetAddBindingListener(QueryAssembler.AddBindingListener addBindingListener)booleansupportsTableAliases()Returnstrueif table aliases are supported.
-
Field Details
-
query
-
queryMetadata
-
translated
protected boolean translated -
sql
-
adapter
-
entityResolver
-
bindings
-
addBindingListener
- Since:
- 4.0
-
-
Constructor Details
-
QueryAssembler
- Since:
- 4.0
-
-
Method Details
-
getPathAliases
Returns aliases for the path splits defined in the query.- Since:
- 3.0
-
getEntityResolver
-
getAdapter
-
getQuery
Returns query object being processed. -
getQueryMetadata
-
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
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
-
getSql
Translates query into an SQL string formatted to use in a PreparedStatement. -
ensureTranslated
protected void ensureTranslated()- Since:
- 4.0
-
doTranslate
protected abstract void doTranslate()- Since:
- 4.0
-
supportsTableAliases
public boolean supportsTableAliases()Returnstrueif table aliases are supported. Default implementation returns false. -
addToParamList
RegistersanObjectas a PreparedStatement parameter.- Parameters:
anObject- object that represents a value of DbAttributedbAttr- DbAttribute being processed.
-
getBindings
- Since:
- 4.0
-
getAliasForExpression
- Since:
- 4.0
-
setAddBindingListener
- Since:
- 4.0
-