Class CosmosSqlQueryBuilder
java.lang.Object
io.micronaut.data.model.query.builder.AbstractSqlLikeQueryBuilder
io.micronaut.data.model.query.builder.sql.SqlQueryBuilder
io.micronaut.data.document.model.query.builder.CosmosSqlQueryBuilder
- All Implemented Interfaces:
- QueryBuilder,- Annotation
The Azure Cosmos DB sql query builder.
- Since:
- 3.9.0
- Author:
- radovanradic
- 
Nested Class SummaryNested classes/interfaces inherited from class io.micronaut.data.model.query.builder.AbstractSqlLikeQueryBuilderAbstractSqlLikeQueryBuilder.CriteriaContext, AbstractSqlLikeQueryBuilder.CriterionHandler<T extends QueryModel.Criterion>, AbstractSqlLikeQueryBuilder.Placeholder, AbstractSqlLikeQueryBuilder.QueryPosition, AbstractSqlLikeQueryBuilder.QueryPropertyPath, AbstractSqlLikeQueryBuilder.QueryState
- 
Field SummaryFields inherited from class io.micronaut.data.model.query.builder.sql.SqlQueryBuilderDEFAULT_POSITIONAL_PARAMETER_MARKER, SQL_SERVER_FOR_UPDATE_CLAUSE, STANDARD_FOR_UPDATE_CLAUSEFields inherited from class io.micronaut.data.model.query.builder.AbstractSqlLikeQueryBuilderALIAS_REPLACE, ALIAS_REPLACE_QUOTED, AND, AS_CLAUSE, 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, JSON_COLUMN, LESS_THAN, LESS_THAN_OR_EQUALS, LOGICAL_AND, LOGICAL_OR, MAX, MIN, NOT, NOT_EQUALS, OPEN_BRACKET, OR, ORDER_BY_CLAUSE, queryHandlers, SELECT_CLAUSE, SPACE, SUM, UPDATE_CLAUSE, WHERE_CLAUSEFields inherited from interface io.micronaut.data.model.query.builder.QueryBuilderVARIABLE_PATTERN
- 
Constructor SummaryConstructorsConstructorDescriptionDefault constructor.CosmosSqlQueryBuilder(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected booleanappendAssociationProjection(AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryString, PersistentProperty property, PersistentPropertyPath propertyPath) Appends selection projection for the property which is association.protected StringBuilderappendDeleteClause(StringBuilder queryString) Append the delete clause.protected voidappendProjectionRowCount(StringBuilder queryString, String logicalName) Appends a row count projection to the query string.protected StringConvert the literal value to it's SQL representation.buildInsert(io.micronaut.core.annotation.AnnotationMetadata repositoryMetadata, PersistentEntity entity) Builds an insert statement for the given entity.protected voidbuildJoin(String joinType, StringBuilder sb, AbstractSqlLikeQueryBuilder.QueryState queryState, List<Association> joinAssociationsPath, String joinAlias, Association association, PersistentEntity associatedEntity, PersistentEntity associationOwner, String currentJoinAlias) Builds join, adding fields and criteria.@NonNull QueryResultbuildPagination(@NonNull Pageable pageable) Encode the pageable.buildQuery(@NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull QueryModel query) Encode the given query for the passed annotation metadata and query.buildUpdate(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, QueryModel query, Map<String, Object> propertiesToUpdate) Encode the given query into the encoded query instance.protected booleanWhether property path expressions require computation by the implementation.protected NamingStrategygetNamingStrategy(PersistentEntity entity) GetsNamingStrategyfor the entity.protected NamingStrategygetNamingStrategy(PersistentPropertyPath propertyPath) GetsNamingStrategyfor the property path.protected booleanisAliasForBatch(PersistentEntity persistentEntity, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Should aliases be used in batch statements.protected voidselectAllColumns(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryBuffer) Obtain the string that selects all columns from the entity.protected voidselectAllColumnsFromJoinPaths(AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryBuffer, Collection<JoinPath> allPaths, @Nullable Map<JoinPath, String> joinAliasOverride) protected voidtraversePersistentProperties(List<Association> associations, PersistentProperty property, BiConsumer<List<Association>, PersistentProperty> consumerProperty) Traverses persistent properties.Methods inherited from class io.micronaut.data.model.query.builder.sql.SqlQueryBuilderannotationType, appendForUpdate, appendUpdateSetParameter, buildBatchCreateTableStatement, buildBatchDropTableStatement, buildCreateTableStatements, buildDropTableStatements, buildJoin, buildJoinTableInsert, concat, dialect, escapeQueries, formatParameter, getAliasName, getColumnName, getDialect, getTableAsKeyword, getTableName, isExpandEmbedded, isForeignKeyWithJoinTable, positionalParameterFormat, positionalParameterName, positionalParameterPattern, quote, resolveJoinType, selectAllColumns, selectAutoStrategy, shouldAliasProjections, shouldEscape, supportsForUpdateMethods inherited from class io.micronaut.data.model.query.builder.AbstractSqlLikeQueryBuilderaddCriterionHandler, appendOrder, appendPropertyRef, appendTransformed, asLiterals, asPath, buildAdditionalWhereClause, buildAdditionalWhereString, buildAdditionalWhereString, buildDelete, buildOrderBy, buildOrderBy, buildSelect, buildUpdate, buildWhereClause, checkDialectSupportsJsonEntity, getAliasName, getColumnAlias, getDataTransformerReadValue, getDataTransformerWriteValue, getMappedName, getMappedName, getMappedName, getPathOnlyAliasName, getUnescapedTableName, handleSubQuery, isJsonEntity, newBindingContext, resolveWhereForAnnotationMetadata, selectAllColumns, traversePersistentProperties, traversePersistentProperties, traversePersistentPropertiesMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.data.model.query.builder.QueryBuilderbuildDelete, buildDelete, buildOrderBy, buildUpdate, buildUpdate, buildUpdate
- 
Constructor Details- 
CosmosSqlQueryBuilder@Creator public CosmosSqlQueryBuilder(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) 
- 
CosmosSqlQueryBuilderpublic CosmosSqlQueryBuilder()Default constructor.
 
- 
- 
Method Details- 
asLiteralDescription copied from class:AbstractSqlLikeQueryBuilderConvert the literal value to it's SQL representation.- Overrides:
- asLiteralin class- SqlQueryBuilder
- Parameters:
- value- The literal value
- Returns:
- converter value
 
- 
appendProjectionRowCountDescription copied from class:AbstractSqlLikeQueryBuilderAppends a row count projection to the query string.- Overrides:
- appendProjectionRowCountin class- SqlQueryBuilder
- Parameters:
- queryString- The query string
- logicalName- The alias to the table name
 
- 
getNamingStrategyDescription copied from class:AbstractSqlLikeQueryBuilderGetsNamingStrategyfor the entity. Subclasses might override and potentially provide different strategy in some cases.- Overrides:
- getNamingStrategyin class- AbstractSqlLikeQueryBuilder
- Parameters:
- entity- the persistent entity
- Returns:
- naming strategy for the entity
 
- 
getNamingStrategyDescription copied from class:AbstractSqlLikeQueryBuilderGetsNamingStrategyfor the property path. Subclasses might override and potentially provide different strategy in some cases.- Overrides:
- getNamingStrategyin class- AbstractSqlLikeQueryBuilder
- Parameters:
- propertyPath- the property path representation
- Returns:
- naming strategy for the property path
 
- 
traversePersistentPropertiesprotected void traversePersistentProperties(List<Association> associations, PersistentProperty property, BiConsumer<List<Association>, PersistentProperty> consumerProperty) Description copied from class:AbstractSqlLikeQueryBuilderTraverses persistent properties.- Overrides:
- traversePersistentPropertiesin class- AbstractSqlLikeQueryBuilder
- Parameters:
- associations- The association list being traversed with the property
- property- The persistent property
- consumerProperty- The function to invoke on every property
 
- 
buildQuerypublic QueryResult buildQuery(@NonNull @NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull @NonNull QueryModel query) Description copied from interface:QueryBuilderEncode the given query for the passed annotation metadata and query.- Specified by:
- buildQueryin interface- QueryBuilder
- Overrides:
- buildQueryin class- AbstractSqlLikeQueryBuilder
- Parameters:
- annotationMetadata- The annotation metadata
- query- The query model
- Returns:
- The query result
 
- 
selectAllColumnsFromJoinPaths@Internal protected void selectAllColumnsFromJoinPaths(AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryBuffer, Collection<JoinPath> allPaths, @Nullable @Nullable Map<JoinPath, String> joinAliasOverride) - Overrides:
- selectAllColumnsFromJoinPathsin class- SqlQueryBuilder
 
- 
appendAssociationProjectionprotected boolean appendAssociationProjection(AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryString, PersistentProperty property, PersistentPropertyPath propertyPath) Description copied from class:AbstractSqlLikeQueryBuilderAppends selection projection for the property which is association.- Overrides:
- appendAssociationProjectionin class- AbstractSqlLikeQueryBuilder
- Parameters:
- queryState- the query state
- queryString- the query string builder
- property- the persistent property
- propertyPath- the persistent property path
- Returns:
- true if association projection is appended, otherwise false
 
- 
selectAllColumnsprotected void selectAllColumns(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryBuffer) Description copied from class:AbstractSqlLikeQueryBuilderObtain the string that selects all columns from the entity.- Overrides:
- selectAllColumnsin class- SqlQueryBuilder
- Parameters:
- annotationMetadata- The annotation metadata
- queryState- The query state
 
- 
buildJoinprotected void buildJoin(String joinType, StringBuilder sb, AbstractSqlLikeQueryBuilder.QueryState queryState, List<Association> joinAssociationsPath, String joinAlias, Association association, PersistentEntity associatedEntity, PersistentEntity associationOwner, String currentJoinAlias) Description copied from class:SqlQueryBuilderBuilds join, adding fields and criteria.- Overrides:
- buildJoinin class- SqlQueryBuilder
- Parameters:
- joinType- the join type
- sb- string builder that join will be added to
- queryState- the query state
- joinAssociationsPath- the list of associations
- joinAlias- the join alias
- association- the association
- associatedEntity- the associated entity
- associationOwner- the association owner
- currentJoinAlias- the current join alias
 
- 
appendDeleteClauseDescription copied from class:AbstractSqlLikeQueryBuilderAppend the delete clause.- Overrides:
- appendDeleteClausein class- AbstractSqlLikeQueryBuilder
- Parameters:
- queryString- The query string
- Returns:
- The delete clause
 
- 
isAliasForBatchprotected boolean isAliasForBatch(PersistentEntity persistentEntity, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Description copied from class:AbstractSqlLikeQueryBuilderShould aliases be used in batch statements.- Overrides:
- isAliasForBatchin class- SqlQueryBuilder
- Parameters:
- persistentEntity- the persistent entity
- annotationMetadata- the method annotation metadata
- Returns:
- True if they should
 
- 
computePropertyPathsprotected boolean computePropertyPaths()Description copied from class:AbstractSqlLikeQueryBuilderWhether property path expressions require computation by the implementation. In a certain query dialects property paths are supported (such as JPA-QL where you can do select foo.bar) whilst for explicit SQL queries paths like this have to be computed into aliases / column name references.- Overrides:
- computePropertyPathsin class- SqlQueryBuilder
- Returns:
- True if property path computation is required.
 
- 
buildInsertpublic QueryResult buildInsert(io.micronaut.core.annotation.AnnotationMetadata repositoryMetadata, PersistentEntity entity) Description copied from interface:QueryBuilderBuilds an insert statement for the given entity.- Specified by:
- buildInsertin interface- QueryBuilder
- Overrides:
- buildInsertin class- SqlQueryBuilder
- Parameters:
- repositoryMetadata- The repository annotation metadata
- entity- The entity
- Returns:
- The insert statement or null if the implementation doesn't require insert statements
 
- 
buildUpdatepublic QueryResult buildUpdate(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, QueryModel query, Map<String, Object> propertiesToUpdate) Description copied from interface:QueryBuilderEncode the given query into the encoded query instance.- Specified by:
- buildUpdatein interface- QueryBuilder
- Overrides:
- buildUpdatein class- AbstractSqlLikeQueryBuilder
- Parameters:
- annotationMetadata- The annotation metadata
- query- The query
- propertiesToUpdate- The property names to update
- Returns:
- The encoded query
 
- 
buildPaginationDescription copied from interface:QueryBuilderEncode the pageable.- Specified by:
- buildPaginationin interface- QueryBuilder
- Overrides:
- buildPaginationin class- SqlQueryBuilder
- Parameters:
- pageable- The pageable
- Returns:
- The encoded query
 
 
-