Class QueryBuilder
java.lang.Object
org.hibernate.envers.internal.tools.query.QueryBuilder
A class for incrementally building a HQL query.
-
Constructor Summary
ConstructorsConstructorDescriptionQueryBuilder
(String entityName, String alias, SessionFactoryImplementor sessionFactory) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an entity from which to select.void
addOrder
(String alias, String propertyName, boolean ascending, NullPrecedence nullPrecedence) void
addOrderFragment
(String alias, String orderByCollectionRole) addParameters
(String alias) void
addProjection
(String function, String alias, String propertyName, boolean distinct) void
addProjection
(Configuration configuration, Map<String, String> aliasToEntityNameMap, Map<String, String> aliasToComponentPropertyNameMap, AuditFunction function) protected static void
appendFunctionArgument
(Configuration configuration, Map<String, String> aliasToEntityNameMap, Map<String, String> aliasToComponentPropertyNameMap, MutableInteger paramCounter, Map<String, Object> queryParamValues, String alias, StringBuilder expression, Object argument) void
build
(StringBuilder sb, Map<String, Object> queryParamValues) Builds the given query, appending results to the given string buffer, and adding all query parameter values that are used to the map provided.deepCopy()
getAlias()
newSubQueryBuilder
(String entityName, String alias)
-
Constructor Details
-
QueryBuilder
- Parameters:
entityName
- Main entity which should be selected.alias
- Alias of the entitysessionFactory
- Session factory
-
-
Method Details
-
deepCopy
-
getAlias
- Returns:
- the main alias of this query builder
-
addFrom
Add an entity from which to select.- Parameters:
entityName
- Name of the entity from which to select.alias
- Alias of the entity. Should be different than all other aliases.select
- whether the entity should be selected
-
addJoin
-
generateAlias
-
newSubQueryBuilder
- Parameters:
entityName
- Entity name, which will be the main entity for the sub-query.alias
- Alias of the entity, which can later be used in parameters.- Returns:
- A sub-query builder for the given entity, with the given alias. The sub-query can be later used as a value of a parameter.
-
getRootParameters
-
addParameters
-
addOrder
public void addOrder(String alias, String propertyName, boolean ascending, NullPrecedence nullPrecedence) -
addOrderFragment
-
addProjection
-
addProjection
public void addProjection(Configuration configuration, Map<String, String> aliasToEntityNameMap, Map<String, String> aliasToComponentPropertyNameMap, AuditFunction function) -
appendFunctionArgument
protected static void appendFunctionArgument(Configuration configuration, Map<String, String> aliasToEntityNameMap, Map<String, String> aliasToComponentPropertyNameMap, MutableInteger paramCounter, Map<String, Object> queryParamValues, String alias, StringBuilder expression, Object argument) -
build
Builds the given query, appending results to the given string buffer, and adding all query parameter values that are used to the map provided.- Parameters:
sb
- String builder to which the query will be appended.queryParamValues
- Map to which name and values of parameters used in the query should be added.
-
getRootAlias
-
toQuery
-