Class OrmQueryDetail
- java.lang.Object
-
- io.ebeaninternal.server.querydefn.OrmQueryDetail
-
- All Implemented Interfaces:
Serializable
public class OrmQueryDetail extends Object implements Serializable
Represents the internal structure of an Object Relational query.Holds the select() and join() details of a ORM query.
It is worth noting that for AutoTune a "tuned fetch info" builds an instance of OrmQueryDetail. Tuning a query is a matter of replacing an instance of this class with one that has been tuned with select() and join() set.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OrmQueryDetail()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNested(String path, OrmQueryDetail other, FetchConfig config)
Add a nested OrmQueryDetail to this detail.String
asString()
Return the detail in string form.void
clear()
Remove all joins and properties.OrmQueryDetail
copy()
Return a deep copy of the OrmQueryDetail.Set<Map.Entry<String,OrmQueryProperties>>
entries()
Return the underlying fetch path entries.void
fetch(String path, String partialProps, FetchConfig fetchConfig)
Set the fetch properties and configuration for a given path.void
fetch(String path, LinkedHashSet<String> properties)
Add for raw sql etc when the properties are already parsed into a set.OrmQueryProperties
getChunk(String path, boolean create)
Set<String>
getFetchPaths()
Return the fetch paths for this detail.int
hashCode()
boolean
hasSelectClause()
void
includeBeanJoin(String parentPath, String propertyName)
Add the explicit bean join.boolean
includesPath(String path)
Return true if the fetch path is included.boolean
isAutoTuneEqual(OrmQueryDetail otherDetail)
Return true if equal in terms of autoTune (select and fetch without property ordering).boolean
isEmpty()
Return true if the query detail has neither select properties specified or any joins defined.boolean
isJoinsEmpty()
Return true if there are no joins.void
queryPlanHash(StringBuilder builder)
Calculate the hash for the query plan.void
select(String columns)
set the properties to include on the base / root entity.void
setBase(OrmQueryProperties baseProps)
Set the base / root query properties.void
setDefaultSelectClause(BeanDescriptor<?> desc)
Set any default select clauses for the main bean and any joins that have not explicitly defined a select clause.void
setEmptyBase()
Set the base query properties to be empty.void
sortFetchPaths(BeanDescriptor<?> d)
Sort the fetch paths into depth order adding any missing parent paths if necessary.String
toString()
-
-
-
Constructor Detail
-
OrmQueryDetail
public OrmQueryDetail()
-
-
Method Detail
-
copy
public OrmQueryDetail copy()
Return a deep copy of the OrmQueryDetail.
-
addNested
public void addNested(String path, OrmQueryDetail other, FetchConfig config)
Add a nested OrmQueryDetail to this detail.
-
queryPlanHash
public void queryPlanHash(StringBuilder builder)
Calculate the hash for the query plan.
-
isAutoTuneEqual
public boolean isAutoTuneEqual(OrmQueryDetail otherDetail)
Return true if equal in terms of autoTune (select and fetch without property ordering).
-
setEmptyBase
public void setEmptyBase()
Set the base query properties to be empty.
-
setBase
public void setBase(OrmQueryProperties baseProps)
Set the base / root query properties.
-
clear
public void clear()
Remove all joins and properties.Typically for the row count query.
-
fetch
public void fetch(String path, String partialProps, FetchConfig fetchConfig)
Set the fetch properties and configuration for a given path.- Parameters:
path
- the property to joinpartialProps
- the properties on the join property to include
-
fetch
public void fetch(String path, LinkedHashSet<String> properties)
Add for raw sql etc when the properties are already parsed into a set.
-
sortFetchPaths
public void sortFetchPaths(BeanDescriptor<?> d)
Sort the fetch paths into depth order adding any missing parent paths if necessary.
-
setDefaultSelectClause
public void setDefaultSelectClause(BeanDescriptor<?> desc)
Set any default select clauses for the main bean and any joins that have not explicitly defined a select clause.That is this will use FetchType.LAZY to exclude some properties by default.
-
hasSelectClause
public boolean hasSelectClause()
-
isEmpty
public boolean isEmpty()
Return true if the query detail has neither select properties specified or any joins defined.
-
isJoinsEmpty
public boolean isJoinsEmpty()
Return true if there are no joins.
-
includeBeanJoin
public void includeBeanJoin(String parentPath, String propertyName)
Add the explicit bean join.This is also used to Exclude the matching property from the parent select (aka remove the foreign key) because it is now included in it's on node in the SqlTree.
-
getChunk
public OrmQueryProperties getChunk(String path, boolean create)
-
includesPath
public boolean includesPath(String path)
Return true if the fetch path is included.
-
getFetchPaths
public Set<String> getFetchPaths()
Return the fetch paths for this detail.
-
entries
public Set<Map.Entry<String,OrmQueryProperties>> entries()
Return the underlying fetch path entries.
-
-