@Internal public class JpaQueryBuilder extends AbstractSqlLikeQueryBuilder implements QueryBuilder
AbstractSqlLikeQueryBuilder.CriteriaContext, AbstractSqlLikeQueryBuilder.CriterionHandler<T extends QueryModel.Criterion>, AbstractSqlLikeQueryBuilder.Placeholder, AbstractSqlLikeQueryBuilder.QueryPosition, AbstractSqlLikeQueryBuilder.QueryPropertyPath, AbstractSqlLikeQueryBuilder.QueryState
ALIAS_REPLACE, ALIAS_REPLACE_QUOTED, AND, AS_CLAUSE, AUTO_POPULATED_PARAMETER_PREFIX, AVG, CLOSE_BRACKET, COMMA, COUNT_DISTINCT, DELETE_CLAUSE, DISTINCT, DOT, EQUALS, EQUALS_FALSE, EQUALS_TRUE, FROM_CLAUSE, FUNCTION_COUNT, GREATER_THAN, GREATER_THAN_OR_EQUALS, IS_EMPTY, IS_NOT_EMPTY, IS_NOT_NULL, IS_NULL, LESS_THAN, LESS_THAN_OR_EQUALS, LOGICAL_AND, LOGICAL_OR, MAX, MIN, NOT_CLAUSE, NOT_EQUALS, OPEN_BRACKET, OR, ORDER_BY_CLAUSE, queryHandlers, SELECT_CLAUSE, SPACE, SUM, UPDATE_CLAUSE, WHERE_CLAUSE
IN_VARIABLES_PATTERN, VARIABLE_PATTERN
Constructor and Description |
---|
JpaQueryBuilder()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected java.lang.StringBuilder |
appendDeleteClause(java.lang.StringBuilder queryString)
Append the delete clause.
|
protected void |
appendProjectionRowCount(java.lang.StringBuilder queryString,
java.lang.String logicalName)
Appends a row count projection to the query string.
|
QueryResult |
buildInsert(io.micronaut.core.annotation.AnnotationMetadata repositoryMetadata,
PersistentEntity entity)
Builds an insert statement for the given entity.
|
protected java.lang.String[] |
buildJoin(java.lang.String alias,
JoinPath joinPath,
java.lang.String joinType,
java.lang.StringBuilder target,
java.util.Map<java.lang.String,java.lang.String> appliedJoinPaths,
AbstractSqlLikeQueryBuilder.QueryState queryState)
Build a join expression for the given alias, association, join type and builder.
|
QueryResult |
buildPagination(Pageable pageable)
Encode the pageable.
|
protected boolean |
computePropertyPaths()
Whether property path expressions require computation by the implementation.
|
protected AbstractSqlLikeQueryBuilder.Placeholder |
formatParameter(int index)
Format the parameter at the given index.
|
java.lang.String |
getAliasName(PersistentEntity entity)
Get an alias name for the given entity.
|
protected java.lang.String |
getColumnName(PersistentProperty persistentProperty)
Get the column name for the given property.
|
protected java.lang.String |
getTableName(PersistentEntity entity)
Get the table name for the given entity.
|
protected boolean |
isAliasForBatch()
Should aliases be used in batch statements.
|
protected java.lang.String |
quote(java.lang.String persistedName)
Quote a column name for the dialect.
|
java.lang.String |
resolveJoinType(Join.Type jt)
Resolves the join type.
|
protected void |
selectAllColumns(AbstractSqlLikeQueryBuilder.QueryState queryState,
java.lang.StringBuilder queryBuffer)
Obtain the string that selects all columns from the entity.
|
protected void |
selectAllColumns(PersistentEntity entity,
java.lang.String alias,
java.lang.StringBuilder queryBuffer)
Selects all columns for the given entity and alias.
|
addCriterionHandler, appendForUpdate, appendUpdateSetParameter, asPath, buildDelete, buildOrderBy, buildQuery, buildUpdate, formatEndsWith, formatStartsWith, formatStartsWithBeginning, formEndsWithEnd, getAliasName, getDataTransformerReadValue, getDataTransformerWriteValue, getPathOnlyAliasName, getTableAsKeyword, getUnescapedTableName, handleSubQuery, isExpandEmbedded, shouldEscape, traversePersistentProperties, traversePersistentProperties, traversePersistentProperties
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
buildDelete, buildDelete, buildOrderBy, buildQuery, buildQuery, buildUpdate, buildUpdate, newQueryBuilder, shouldAliasProjections, supportsForUpdate
protected java.lang.String quote(java.lang.String persistedName)
AbstractSqlLikeQueryBuilder
quote
in class AbstractSqlLikeQueryBuilder
persistedName
- The persisted name.public java.lang.String getAliasName(PersistentEntity entity)
AbstractSqlLikeQueryBuilder
getAliasName
in class AbstractSqlLikeQueryBuilder
entity
- The entityprotected java.lang.String[] buildJoin(java.lang.String alias, JoinPath joinPath, java.lang.String joinType, java.lang.StringBuilder target, java.util.Map<java.lang.String,java.lang.String> appliedJoinPaths, AbstractSqlLikeQueryBuilder.QueryState queryState)
AbstractSqlLikeQueryBuilder
buildJoin
in class AbstractSqlLikeQueryBuilder
alias
- The aliasjoinPath
- The join pathjoinType
- The join type stringtarget
- The target builderappliedJoinPaths
- The applied joins pathsqueryState
- The query stateprotected java.lang.String getTableName(PersistentEntity entity)
AbstractSqlLikeQueryBuilder
getTableName
in class AbstractSqlLikeQueryBuilder
entity
- The entityprotected java.lang.String getColumnName(PersistentProperty persistentProperty)
AbstractSqlLikeQueryBuilder
getColumnName
in class AbstractSqlLikeQueryBuilder
persistentProperty
- The propertyprotected void selectAllColumns(AbstractSqlLikeQueryBuilder.QueryState queryState, java.lang.StringBuilder queryBuffer)
AbstractSqlLikeQueryBuilder
selectAllColumns
in class AbstractSqlLikeQueryBuilder
queryState
- The query stateprotected void selectAllColumns(PersistentEntity entity, java.lang.String alias, java.lang.StringBuilder queryBuffer)
AbstractSqlLikeQueryBuilder
selectAllColumns
in class AbstractSqlLikeQueryBuilder
entity
- The entityalias
- The aliasqueryBuffer
- The buffer to append the columnsprotected void appendProjectionRowCount(java.lang.StringBuilder queryString, java.lang.String logicalName)
AbstractSqlLikeQueryBuilder
appendProjectionRowCount
in class AbstractSqlLikeQueryBuilder
queryString
- The query stringlogicalName
- The alias to the table nameprotected final boolean computePropertyPaths()
AbstractSqlLikeQueryBuilder
computePropertyPaths
in class AbstractSqlLikeQueryBuilder
protected boolean isAliasForBatch()
AbstractSqlLikeQueryBuilder
isAliasForBatch
in class AbstractSqlLikeQueryBuilder
protected AbstractSqlLikeQueryBuilder.Placeholder formatParameter(int index)
AbstractSqlLikeQueryBuilder
formatParameter
in class AbstractSqlLikeQueryBuilder
index
- The parameterpublic java.lang.String resolveJoinType(Join.Type jt)
AbstractSqlLikeQueryBuilder
resolveJoinType
in class AbstractSqlLikeQueryBuilder
jt
- The join type@Nullable public QueryResult buildInsert(io.micronaut.core.annotation.AnnotationMetadata repositoryMetadata, PersistentEntity entity)
QueryBuilder
buildInsert
in interface QueryBuilder
repositoryMetadata
- The repository annotation metadataentity
- The entity@NonNull protected java.lang.StringBuilder appendDeleteClause(java.lang.StringBuilder queryString)
AbstractSqlLikeQueryBuilder
appendDeleteClause
in class AbstractSqlLikeQueryBuilder
queryString
- The query string@NonNull public QueryResult buildPagination(@NonNull Pageable pageable)
QueryBuilder
buildPagination
in interface QueryBuilder
pageable
- The pageable