public class QueryBuilder
extends java.lang.Object
Constructor and Description |
---|
QueryBuilder(java.lang.String entityName,
java.lang.String alias) |
Modifier and Type | Method and Description |
---|---|
void |
addFrom(java.lang.String entityName,
java.lang.String alias,
boolean select)
Add an entity from which to select.
|
Parameters |
addJoin(javax.persistence.criteria.JoinType joinType,
java.lang.String entityName,
java.lang.String alias,
boolean select) |
void |
addOrder(java.lang.String alias,
java.lang.String propertyName,
boolean ascending) |
Parameters |
addParameters(java.lang.String alias) |
void |
addProjection(java.lang.String function,
java.lang.String alias,
java.lang.String propertyName,
boolean distinct) |
void |
build(java.lang.StringBuilder sb,
java.util.Map<java.lang.String,java.lang.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() |
java.lang.String |
generateAlias() |
java.lang.String |
getAlias() |
java.lang.String |
getRootAlias() |
Parameters |
getRootParameters() |
QueryBuilder |
newSubQueryBuilder(java.lang.String entityName,
java.lang.String alias) |
Query |
toQuery(Session session) |
public QueryBuilder(java.lang.String entityName, java.lang.String alias)
entityName
- Main entity which should be selected.alias
- Alias of the entitypublic QueryBuilder deepCopy()
public java.lang.String getAlias()
public void addFrom(java.lang.String entityName, java.lang.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(javax.persistence.criteria.JoinType joinType, java.lang.String entityName, java.lang.String alias, boolean select)
public java.lang.String generateAlias()
public QueryBuilder newSubQueryBuilder(java.lang.String entityName, java.lang.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(java.lang.String alias)
public void addOrder(java.lang.String alias, java.lang.String propertyName, boolean ascending)
public void addProjection(java.lang.String function, java.lang.String alias, java.lang.String propertyName, boolean distinct)
public void build(java.lang.StringBuilder sb, java.util.Map<java.lang.String,java.lang.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 java.lang.String getRootAlias()
Copyright © 2001-2018 Red Hat, Inc. All Rights Reserved.