Package org.apache.cayenne.map
Class QueryDescriptorLoader
java.lang.Object
org.apache.cayenne.map.QueryDescriptorLoader
public class QueryDescriptorLoader extends Object
A builder that constructs Cayenne queries from abstract configuration information
defined in cayenne-data-map*.dtd. This abstract builder supports values declared in the
DTD, allowing subclasses to define their own Query creation logic.
- Since:
- 4.0
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,String>adapterSqlprotected DataMapdataMapprotected Stringejbqlprotected Stringnameprotected List<Ordering>orderingsprotected HashMap<String,Integer>prefetchesMapprotected Map<String,String>propertiesprotected Expressionqualifierprotected StringqueryTypeprotected StringresultEntityprotected StringrootNameprotected StringrootTypeprotected Stringsql -
Constructor Summary
Constructors Constructor Description QueryDescriptorLoader() -
Method Summary
Modifier and Type Method Description voidaddOrdering(String path, String descending, String ignoreCase)voidaddPrefetch(String path, int semantics)voidaddProperty(String name, String value)voidaddSql(String sql, String adapterClass)Adds raw sql.QueryDescriptorbuildQueryDescriptor()Builds a Query object based on internal configuration information.protected ObjectgetRoot()Determines query root based on configuration info, falls back to a DataMap root if the data is invalid.voidsetEjbql(String ejbql)voidsetLegacyFactory(String factory)It's better be handled by project upgrade handler and actually it is.voidsetName(String name)voidsetQualifier(String qualifier)voidsetQueryType(String queryType)voidsetResultEntity(String resultEntity)voidsetRoot(DataMap dataMap, String rootType, String rootName)Sets the information pertaining to the root of the query.
-
Field Details
-
name
-
queryType
-
sql
-
ejbql
-
qualifier
-
dataMap
-
rootType
-
rootName
-
resultEntity
-
orderings
-
prefetchesMap
-
adapterSql
-
properties
-
-
Constructor Details
-
QueryDescriptorLoader
public QueryDescriptorLoader()
-
-
Method Details
-
buildQueryDescriptor
Builds a Query object based on internal configuration information. -
setName
-
setLegacyFactory
It's better be handled by project upgrade handler and actually it is. But upgrade logic is faulty when project is several versions away and can't be changed without complete upgrade system rewrite- Parameters:
factory- old style query factory class
-
setQueryType
-
getRoot
Determines query root based on configuration info, falls back to a DataMap root if the data is invalid.- Throws:
CayenneRuntimeException- if a valid root can't be established.
-
setResultEntity
-
setRoot
Sets the information pertaining to the root of the query. -
setEjbql
-
addSql
Adds raw sql. If adapterClass parameter is not null, sets the SQL string to be adapter-specific. Otherwise it is used as a default SQL string. -
setQualifier
-
addProperty
-
addOrdering
-
addPrefetch
-