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 interface
QueryAssembler.AddBindingListener
-
Field Summary
Fields Modifier and Type Field Description protected DbAdapter
adapter
protected QueryAssembler.AddBindingListener
addBindingListener
protected List<DbAttributeBinding>
bindings
protected EntityResolver
entityResolver
protected Query
query
protected QueryMetadata
queryMetadata
protected String
sql
protected boolean
translated
-
Constructor Summary
Constructors Constructor Description QueryAssembler(Query query, DbAdapter adapter, EntityResolver entityResolver)
-
Method Summary
Modifier and Type Method Description void
addToParamList(DbAttribute dbAttr, Object anObject)
RegistersanObject
as a PreparedStatement parameter.abstract void
dbRelationshipAdded(DbRelationship relationship, JoinType joinType, String joinSplitAlias)
Appends a join with given semantics to the query.protected abstract void
doTranslate()
protected void
ensureTranslated()
DbAdapter
getAdapter()
abstract String
getAliasForExpression(Expression exp)
DbAttributeBinding[]
getBindings()
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()
String
getSql()
Translates query into an SQL string formatted to use in a PreparedStatement.abstract void
resetJoinStack()
A callback invoked by a child qualifier or ordering processor allowing query assembler to reset its join stack.void
setAddBindingListener(QueryAssembler.AddBindingListener addBindingListener)
boolean
supportsTableAliases()
Returnstrue
if 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()Returnstrue
if table aliases are supported. Default implementation returns false. -
addToParamList
RegistersanObject
as 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
-