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)
Add an entity from which to select.
|
void |
addOrder(String propertyName,
boolean ascending) |
void |
addProjection(String function,
String propertyName,
boolean distinct) |
void |
addProjection(String function,
String propertyName,
boolean distinct,
boolean addAlias) |
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() |
Parameters |
getRootParameters() |
QueryBuilder |
newSubQueryBuilder() |
QueryBuilder |
newSubQueryBuilder(String entityName,
String alias) |
Query |
toQuery(Session session) |
public QueryBuilder deepCopy()
public void addFrom(String entityName, String alias)
entityName
- Name of the entity from which to select.alias
- Alias of the entity. Should be different than all other aliases.public QueryBuilder newSubQueryBuilder()
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 void addOrder(String propertyName, boolean ascending)
public void addProjection(String function, String propertyName, boolean distinct, boolean addAlias)
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.Copyright © 2018 JBoss by Red Hat. All rights reserved.