public class QueryBuilder extends Object
Constructor and Description |
---|
QueryBuilder(String entityName,
String alias) |
Modifier and Type | Method and Description |
---|---|
void |
addFrom(String entityName,
String alias,
boolean select)
Add an entity from which to select.
|
Parameters |
addJoin(JoinType joinType,
String entityName,
String alias,
boolean select) |
void |
addOrder(String alias,
String propertyName,
boolean ascending) |
Parameters |
addParameters(String alias) |
void |
addProjection(String function,
String alias,
String propertyName,
boolean distinct) |
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.
|
QueryBuilder |
deepCopy() |
String |
generateAlias() |
String |
getAlias() |
String |
getRootAlias() |
Parameters |
getRootParameters() |
QueryBuilder |
newSubQueryBuilder(String entityName,
String alias) |
Query |
toQuery(Session session) |
public QueryBuilder deepCopy()
public String getAlias()
public void addFrom(String entityName, String alias, boolean select)
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 selectedpublic Parameters addJoin(JoinType joinType, String entityName, String alias, boolean select)
public String generateAlias()
public QueryBuilder newSubQueryBuilder(String entityName, String alias)
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.public Parameters getRootParameters()
public Parameters addParameters(String alias)
public void addProjection(String function, String alias, String propertyName, boolean distinct)
public void build(StringBuilder sb, Map<String,Object> queryParamValues)
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.public String getRootAlias()
Copyright © 2018 JBoss by Red Hat. All rights reserved.