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>
adapterSql
protected DataMap
dataMap
protected String
ejbql
protected String
name
protected List<Ordering>
orderings
protected HashMap<String,Integer>
prefetchesMap
protected Map<String,String>
properties
protected Expression
qualifier
protected String
queryType
protected String
resultEntity
protected String
rootName
protected String
rootType
protected String
sql
-
Constructor Summary
Constructors Constructor Description QueryDescriptorLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOrdering(String path, String descending, String ignoreCase)
void
addPrefetch(String path, int semantics)
void
addProperty(String name, String value)
void
addSql(String sql, String adapterClass)
Adds raw sql.QueryDescriptor
buildQueryDescriptor()
Builds a Query object based on internal configuration information.protected Object
getRoot()
Determines query root based on configuration info, falls back to a DataMap root if the data is invalid.void
setEjbql(String ejbql)
void
setLegacyFactory(String factory)
It's better be handled by project upgrade handler and actually it is.void
setName(String name)
void
setQualifier(String qualifier)
void
setQueryType(String queryType)
void
setResultEntity(String resultEntity)
void
setRoot(DataMap dataMap, String rootType, String rootName)
Sets the information pertaining to the root of the query.
-
-
-
Field Detail
-
name
protected String name
-
queryType
protected String queryType
-
sql
protected String sql
-
ejbql
protected String ejbql
-
qualifier
protected Expression qualifier
-
dataMap
protected DataMap dataMap
-
rootType
protected String rootType
-
rootName
protected String rootName
-
resultEntity
protected String resultEntity
-
-
Method Detail
-
buildQueryDescriptor
public QueryDescriptor buildQueryDescriptor()
Builds a Query object based on internal configuration information.
-
setName
public void setName(String name)
-
setLegacyFactory
public void setLegacyFactory(String factory)
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
public void setQueryType(String queryType)
-
getRoot
protected Object 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
public void setResultEntity(String resultEntity)
-
setRoot
public void setRoot(DataMap dataMap, String rootType, String rootName)
Sets the information pertaining to the root of the query.
-
setEjbql
public void setEjbql(String ejbql)
-
addSql
public void addSql(String sql, String adapterClass)
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
public void setQualifier(String qualifier)
-
addPrefetch
public void addPrefetch(String path, int semantics)
-
-