Class AbstractSqlLikeQueryBuilder
java.lang.Object
io.micronaut.data.model.query.builder.AbstractSqlLikeQueryBuilder
- All Implemented Interfaces:
- QueryBuilder
- Direct Known Subclasses:
- JpaQueryBuilder,- SqlQueryBuilder
An abstract class for builders that build SQL-like queries.
- Since:
- 1.0.0
- Author:
- graemerocher
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionprotected static interfaceA criterion context.protected static interfaceA criterion handler.static final classRepresents a placeholder in query.protected static enumprotected classRepresents a path to a property.protected final classThe state of the query.
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final charprotected static final charprotected static final Stringprotected static final Stringprotected static final Stringprotected static final charprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final Stringprotected static final charprotected static final Stringstatic final Stringprotected final Map<Class,AbstractSqlLikeQueryBuilder.CriterionHandler> protected static final Stringprotected static final charprotected static final Stringprotected static final Stringprotected static final StringFields inherited from interface io.micronaut.data.model.query.builder.QueryBuilderVARIABLE_PATTERN
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected <T extends QueryModel.Criterion>
 voidaddCriterionHandler(Class<T> clazz, AbstractSqlLikeQueryBuilder.CriterionHandler<T> handler) Adds criterion handler.protected booleanappendAssociationProjection(AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryString, PersistentProperty property, PersistentPropertyPath propertyPath) Appends selection projection for the property which is association.protected @NonNull StringBuilderappendDeleteClause(StringBuilder queryString) Append the delete clause.protected voidappendForUpdate(AbstractSqlLikeQueryBuilder.QueryPosition queryPosition, QueryModel query, StringBuilder queryBuilder) Adds "forUpdate" pisimmistic locking.protected voidappendOrder(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, QueryModel query, AbstractSqlLikeQueryBuilder.QueryState queryState) Appends order to the query.protected abstract voidappendProjectionRowCount(StringBuilder queryString, String logicalName) Appends a row count projection to the query string.protected voidappendPropertyRef(StringBuilder sb, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, PersistentEntity entity, AbstractSqlLikeQueryBuilder.QueryPropertyPath propertyPath) Appends property to the sql string builder.protected voidappendTransformed(StringBuilder sb, String transformed, Runnable appendParameter) Appends custom query part.protected voidappendUpdateSetParameter(StringBuilder sb, String alias, PersistentProperty prop, Runnable appendParameter) Appends the SET=? call to the query string.protected @NonNull StringConvert the literal value to it's SQL representation.protected voidasLiterals(StringBuilder sb, @Nullable Object value) Appends values as literals to the sql query builder.protected StringasPath(List<Association> associations, PersistentProperty property) Join associations and property as path.protected StringbuildAdditionalWhereClause(AbstractSqlLikeQueryBuilder.QueryState queryState, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Builds additional where clause if there isWhereannotation on the entity.protected final StringbuildAdditionalWhereString(JoinPath joinPath, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Builds WHERE clause based onWhereannotation on the metadata.protected StringbuildAdditionalWhereString(String alias, PersistentEntity entity, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Builds WHERE clause for the entity and given alias ifIgnoreWhereis not present.buildDelete(@NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull QueryModel query) Encode the given query into the encoded query instance.protected abstract String[]buildJoin(String alias, JoinPath joinPath, String joinType, StringBuilder stringBuilder, Map<String, String> appliedJoinPaths, AbstractSqlLikeQueryBuilder.QueryState queryState) Build a join expression for the given alias, association, join type and builder.@NonNull QueryResultbuildOrderBy(@NonNull PersistentEntity entity, @NonNull Sort sort) Encode the given query into the encoded query instance.@NonNull QueryResultbuildOrderBy(String query, @NonNull PersistentEntity entity, @NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull Sort sort) Encode the given query into the encoded query instance.buildQuery(@NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull QueryModel query) Encode the given query for the passed annotation metadata and query.protected voidbuildSelect(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryString, List<QueryModel.Projection> projectionList, String tableAlias, PersistentEntity entity) Build select statement.buildUpdate(@NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull QueryModel query, @NonNull List<String> propertiesToUpdate) Encode the given query into the encoded query instance.buildUpdate(@NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull QueryModel query, @NonNull Map<String, Object> propertiesToUpdate) Encode the given query into the encoded query instance.protected voidbuildWhereClause(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, QueryModel.Junction criteria, AbstractSqlLikeQueryBuilder.QueryState queryState) Builds where clause.protected voidIf and whenEntityRepresentationannotation with JSON type is used for the repository method but dialect does not support JSON entity representations this will throwIllegalArgumentException.protected abstract booleanWhether property path expressions require computation by the implementation.protected voidconcat(StringBuilder writer, Collection<Runnable> partsWriters) protected abstract AbstractSqlLikeQueryBuilder.PlaceholderformatParameter(int index) Format the parameter at the given index.protected StringgetAliasName(PersistentEntity entity) Get an alias name for the given entity.getAliasName(JoinPath joinPath) Get the alias name.protected final StringgetColumnAlias(PersistentProperty property) Gets column alias if defined as alias field on MappedProperty annotation on the mapping field.protected abstract StringgetColumnName(PersistentProperty persistentProperty) Get the column name for the given property.getDataTransformerReadValue(String alias, PersistentProperty prop) Returns transformed value if the data transformer id defined.getDataTransformerWriteValue(String alias, PersistentProperty prop) Returns transformed value if the data transformer id defined.protected DialectGet dialect.protected @NonNull StringgetMappedName(@NonNull NamingStrategy namingStrategy, @NonNull Association association) Gets the mapped name from the association usingNamingStrategy.protected @NonNull StringgetMappedName(@NonNull NamingStrategy namingStrategy, @NonNull PersistentProperty property) Gets the mapped name from the property usingNamingStrategy.protected @NonNull StringgetMappedName(@NonNull NamingStrategy namingStrategy, @NonNull List<Association> associations, @NonNull PersistentProperty property) Gets the mapped name from for the list of associations and property usingNamingStrategy.protected NamingStrategygetNamingStrategy(PersistentEntity entity) GetsNamingStrategyfor the entity.protected NamingStrategygetNamingStrategy(PersistentPropertyPath propertyPath) GetsNamingStrategyfor the property path.protected @NonNull StringgetPathOnlyAliasName(JoinPath joinPath) Get the alias name for just the join path.protected StringGet the AS keyword to use for table aliases.protected abstract StringgetTableName(PersistentEntity entity) Get the table name for the given entity.protected StringGet the table name for the given entity.protected voidhandleSubQuery(AbstractSqlLikeQueryBuilder.CriteriaContext ctx, QueryModel.SubqueryCriterion subqueryCriterion, String comparisonExpression) For handling subqueries.protected abstract booleanisAliasForBatch(PersistentEntity persistentEntity, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Should aliases be used in batch statements.protected booleanShould embedded queries by expanded by the implementation.protected booleanisJsonEntity(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, PersistentEntity entity) Checks whetherEntityRepresentationannotation with JSON type is used for the repository method.protected BindingParameter.BindingContextnewBindingContext(@Nullable PersistentPropertyPath ref) Creates new binding parameter context.protected StringQuote a column name for the dialect.abstract StringResolves the join type.protected final StringresolveWhereForAnnotationMetadata(String alias, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Resolves where clause if there isWhereannotation on the entity.protected abstract voidselectAllColumns(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, PersistentEntity entity, String alias, StringBuilder queryBuffer) Selects all columns for the given entity and alias.protected abstract voidselectAllColumns(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryBuffer) Obtain the string that selects all columns from the entity.protected voidselectAllColumns(PersistentEntity entity, String alias, StringBuilder queryBuffer) Selects all columns for the given entity and alias.protected voidselectAllColumnsFromJoinPaths(AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryBuffer, Collection<JoinPath> allPaths, @Nullable Map<JoinPath, String> joinAliasOverride) protected booleanshouldEscape(@NonNull PersistentEntity entity) Whether queries should be escaped for the given entity.protected voidtraversePersistentProperties(PersistentEntity persistentEntity, boolean includeIdentity, boolean includeVersion, BiConsumer<List<Association>, PersistentProperty> consumer) Traverses persistent properties.protected voidtraversePersistentProperties(PersistentEntity persistentEntity, BiConsumer<List<Association>, PersistentProperty> consumer) Traverses persistent properties.protected voidtraversePersistentProperties(PersistentProperty property, BiConsumer<List<Association>, PersistentProperty> consumer) Traverses persistent properties.protected voidtraversePersistentProperties(List<Association> associations, PersistentProperty property, BiConsumer<List<Association>, PersistentProperty> consumerProperty) Traverses persistent properties.Methods 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, buildInsert, buildPagination, buildUpdate, buildUpdate, shouldAliasProjections, supportsForUpdate
- 
Field Details- 
ORDER_BY_CLAUSE- See Also:
 
- 
SELECT_CLAUSE- See Also:
 
- 
AS_CLAUSE- See Also:
 
- 
FROM_CLAUSE- See Also:
 
- 
WHERE_CLAUSE- See Also:
 
- 
COMMAprotected static final char COMMA- See Also:
 
- 
CLOSE_BRACKETprotected static final char CLOSE_BRACKET- See Also:
 
- 
OPEN_BRACKETprotected static final char OPEN_BRACKET- See Also:
 
- 
SPACEprotected static final char SPACE- See Also:
 
- 
DOTprotected static final char DOT- See Also:
 
- 
NOT- See Also:
 
- 
AND- See Also:
 
- 
LOGICAL_AND- See Also:
 
- 
UPDATE_CLAUSE- See Also:
 
- 
DELETE_CLAUSE- See Also:
 
- 
OR- See Also:
 
- 
LOGICAL_OR- See Also:
 
- 
FUNCTION_COUNT- See Also:
 
- 
AVG- See Also:
 
- 
DISTINCT- See Also:
 
- 
SUM- See Also:
 
- 
MIN- See Also:
 
- 
MAX- See Also:
 
- 
COUNT_DISTINCT- See Also:
 
- 
IS_NOT_NULL- See Also:
 
- 
IS_EMPTY- See Also:
 
- 
IS_NOT_EMPTY- See Also:
 
- 
IS_NULL- See Also:
 
- 
EQUALS_TRUE- See Also:
 
- 
EQUALS_FALSE- See Also:
 
- 
GREATER_THAN_OR_EQUALS- See Also:
 
- 
LESS_THAN_OR_EQUALS- See Also:
 
- 
LESS_THAN- See Also:
 
- 
GREATER_THAN- See Also:
 
- 
EQUALS- See Also:
 
- 
NOT_EQUALS- See Also:
 
- 
ALIAS_REPLACE_QUOTED- See Also:
 
- 
ALIAS_REPLACE- See Also:
 
- 
JSON_COLUMN- See Also:
 
- 
queryHandlers
 
- 
- 
Constructor Details- 
AbstractSqlLikeQueryBuilderpublic AbstractSqlLikeQueryBuilder()
 
- 
- 
Method Details- 
getDialectGet dialect.- Returns:
- dialect
 
- 
asLiteralsAppends values as literals to the sql query builder.- Parameters:
- sb- the sql string builder
- value- the value to be added
 
- 
asLiteralConvert the literal value to it's SQL representation.- Parameters:
- value- The literal value
- Returns:
- converter value
 
- 
concat- Parameters:
- writer- The writer
- partsWriters- The parts writers
 
- 
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
- Parameters:
- annotationMetadata- The annotation metadata
- query- The query model
- Returns:
- The query result
 
- 
getTableNameGet the table name for the given entity.- Parameters:
- entity- The entity
- Returns:
- The table name
 
- 
getUnescapedTableNameGet the table name for the given entity.- Parameters:
- entity- The entity
- Returns:
- The table name
 
- 
getAliasNameGet an alias name for the given entity.- Parameters:
- entity- The entity
- Returns:
- The alias name
 
- 
getAliasNameGet the alias name.- Parameters:
- joinPath- The join path
- Returns:
- The alias
 
- 
getPathOnlyAliasNameGet the alias name for just the join path.- Parameters:
- joinPath- The join path
- Returns:
- The alias
 
- 
buildJoinprotected abstract String[] buildJoin(String alias, JoinPath joinPath, String joinType, StringBuilder stringBuilder, Map<String, String> appliedJoinPaths, AbstractSqlLikeQueryBuilder.QueryState queryState) Build a join expression for the given alias, association, join type and builder.- Parameters:
- alias- The alias
- joinPath- The join path
- joinType- The join type string
- stringBuilder- The target builder
- appliedJoinPaths- The applied joins paths
- queryState- The query state
- Returns:
- An array representing the aliases for each join association in the specified join path
 
- 
getColumnNameGet the column name for the given property.- Parameters:
- persistentProperty- The property
- Returns:
- The column name
 
- 
selectAllColumnsprotected abstract void selectAllColumns(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryBuffer) Obtain the string that selects all columns from the entity.- Parameters:
- annotationMetadata- The annotation metadata
- queryState- The query state
- queryBuffer-
 
- 
selectAllColumnsSelects all columns for the given entity and alias.- Parameters:
- entity- The entity
- alias- The alias
- queryBuffer- The buffer to append the columns
 
- 
selectAllColumnsprotected abstract void selectAllColumns(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, PersistentEntity entity, String alias, StringBuilder queryBuffer) Selects all columns for the given entity and alias.- Parameters:
- annotationMetadata- The annotation metadata
- entity- The entity
- alias- The alias
- queryBuffer- The buffer to append the columns
 
- 
selectAllColumnsFromJoinPaths@Internal protected void selectAllColumnsFromJoinPaths(AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryBuffer, Collection<JoinPath> allPaths, @Nullable @Nullable Map<JoinPath, String> joinAliasOverride) 
- 
shouldEscapeWhether queries should be escaped for the given entity.- Parameters:
- entity- The entity
- Returns:
- True if they should be escaped
 
- 
getTableAsKeywordGet the AS keyword to use for table aliases.- Returns:
- The AS keyword if any
 
- 
quoteQuote a column name for the dialect.- Parameters:
- persistedName- The persisted name.
- Returns:
- The quoted name
 
- 
buildSelectprotected void buildSelect(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryString, List<QueryModel.Projection> projectionList, String tableAlias, PersistentEntity entity) Build select statement.- Parameters:
- annotationMetadata- the annotation metadata
- queryState- the query state
- queryString- the query string builder
- projectionList- projection list (can be empty, then selects all columns)
- tableAlias- the table alias
- entity- the persistent entity
 
- 
appendAssociationProjectionprotected boolean appendAssociationProjection(AbstractSqlLikeQueryBuilder.QueryState queryState, StringBuilder queryString, PersistentProperty property, PersistentPropertyPath propertyPath) Appends selection projection for the property which is association.- 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
 
- 
getNamingStrategyGetsNamingStrategyfor the property path. Subclasses might override and potentially provide different strategy in some cases.- Parameters:
- propertyPath- the property path representation
- Returns:
- naming strategy for the property path
 
- 
getNamingStrategyGetsNamingStrategyfor the entity. Subclasses might override and potentially provide different strategy in some cases.- Parameters:
- entity- the persistent entity
- Returns:
- naming strategy for the entity
 
- 
getMappedName@NonNull protected @NonNull String getMappedName(@NonNull @NonNull NamingStrategy namingStrategy, @NonNull @NonNull PersistentProperty property) Gets the mapped name from the property usingNamingStrategy.- Parameters:
- namingStrategy- the naming strategy being used
- property- the persistent property
- Returns:
- the mapped name for the property
 
- 
getMappedName@NonNull protected @NonNull String getMappedName(@NonNull @NonNull NamingStrategy namingStrategy, @NonNull @NonNull Association association) Gets the mapped name from the association usingNamingStrategy.- Parameters:
- namingStrategy- the naming strategy being used
- association- the associatioon
- Returns:
- the mapped name for the association
 
- 
getMappedName@NonNull protected @NonNull String getMappedName(@NonNull @NonNull NamingStrategy namingStrategy, @NonNull @NonNull List<Association> associations, @NonNull @NonNull PersistentProperty property) Gets the mapped name from for the list of associations and property usingNamingStrategy.- Parameters:
- namingStrategy- the naming strategy
- associations- the association list
- property- the property
- Returns:
- the mappen name for the list of associations and property using given naming strategy
 
- 
appendProjectionRowCountAppends a row count projection to the query string.- Parameters:
- queryString- The query string
- logicalName- The alias to the table name
 
- 
buildWhereClauseprotected void buildWhereClause(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, QueryModel.Junction criteria, AbstractSqlLikeQueryBuilder.QueryState queryState) Builds where clause.- Parameters:
- annotationMetadata- the annotation metadata for the method
- criteria- the criteria
- queryState- the query state
 
- 
buildAdditionalWhereClauseprotected String buildAdditionalWhereClause(AbstractSqlLikeQueryBuilder.QueryState queryState, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Builds additional where clause if there isWhereannotation on the entity.- Parameters:
- queryState- the query state
- annotationMetadata- the annotation metadata
- Returns:
- where clause if there was Whereannotation on the entity (or joins for JPA implementation)
 
- 
buildAdditionalWhereStringprotected String buildAdditionalWhereString(String alias, PersistentEntity entity, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Builds WHERE clause for the entity and given alias ifIgnoreWhereis not present.- Parameters:
- alias- the entity alias
- entity- the entity
- annotationMetadata- the entity metadata
- Returns:
- the WHERE clause
 
- 
buildAdditionalWhereStringprotected final String buildAdditionalWhereString(JoinPath joinPath, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Builds WHERE clause based onWhereannotation on the metadata.- Parameters:
- joinPath- the join path
- annotationMetadata- the annotation metadata
- Returns:
- WHERE clause if Whereannotation is declared andIgnoreWhereis not present, otherwise empty string
 
- 
resolveWhereForAnnotationMetadataprotected final String resolveWhereForAnnotationMetadata(String alias, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Resolves where clause if there isWhereannotation on the entity.- Parameters:
- alias- the entity alias
- annotationMetadata- the entity annotation metadata
- Returns:
- where clause with entity alias if entity has declared where annotation
 
- 
appendOrderprotected void appendOrder(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, QueryModel query, AbstractSqlLikeQueryBuilder.QueryState queryState) Appends order to the query.- Parameters:
- annotationMetadata- the annotation metadata
- query- the query model
- queryState- the query state
 
- 
appendForUpdateprotected void appendForUpdate(AbstractSqlLikeQueryBuilder.QueryPosition queryPosition, QueryModel query, StringBuilder queryBuilder) Adds "forUpdate" pisimmistic locking.- Parameters:
- queryPosition- The query position
- query- The query
- queryBuilder- The builder
 
- 
appendPropertyRefprotected void appendPropertyRef(StringBuilder sb, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, PersistentEntity entity, AbstractSqlLikeQueryBuilder.QueryPropertyPath propertyPath) Appends property to the sql string builder.- Parameters:
- sb- the sql string builder
- annotationMetadata- the annotation metadata
- entity- the persistent entity
- propertyPath- the query property path
 
- 
handleSubQueryprotected void handleSubQuery(AbstractSqlLikeQueryBuilder.CriteriaContext ctx, QueryModel.SubqueryCriterion subqueryCriterion, String comparisonExpression) For handling subqueries.- Parameters:
- ctx- The criteria context
- subqueryCriterion- The subquery criterion
- comparisonExpression- The comparison expression
 
- 
isExpandEmbeddedprotected boolean isExpandEmbedded()Should embedded queries by expanded by the implementation.- Returns:
- True if they should
 
- 
appendUpdateSetParameterprotected void appendUpdateSetParameter(StringBuilder sb, String alias, PersistentProperty prop, Runnable appendParameter) Appends the SET=? call to the query string.- Parameters:
- sb- The string builder
- alias- The alias
- prop- The property
- appendParameter- The append parameter action
 
- 
appendTransformedAppends custom query part.- Parameters:
- sb- The string builder
- transformed- The transformed query part
- appendParameter- The append parameter action
 
- 
computePropertyPathsprotected abstract boolean computePropertyPaths()Whether 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.- Returns:
- True if property path computation is required.
 
- 
buildUpdatepublic QueryResult buildUpdate(@NonNull @NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull @NonNull QueryModel query, @NonNull @NonNull List<String> propertiesToUpdate) Description copied from interface:QueryBuilderEncode the given query into the encoded query instance.- Specified by:
- buildUpdatein interface- QueryBuilder
- Parameters:
- annotationMetadata- The annotation metadata
- query- The query
- propertiesToUpdate- The property names to update
- Returns:
- The encoded query
 
- 
buildUpdatepublic QueryResult buildUpdate(@NonNull @NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull @NonNull QueryModel query, @NonNull @NonNull Map<String, Object> propertiesToUpdate) Description copied from interface:QueryBuilderEncode the given query into the encoded query instance.- Specified by:
- buildUpdatein interface- QueryBuilder
- Parameters:
- annotationMetadata- The annotation metadata
- query- The query
- propertiesToUpdate- The property names to update
- Returns:
- The encoded query
 
- 
buildDeletepublic QueryResult buildDelete(@NonNull @NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull @NonNull QueryModel query) Description copied from interface:QueryBuilderEncode the given query into the encoded query instance.- Specified by:
- buildDeletein interface- QueryBuilder
- Parameters:
- annotationMetadata- The annotation metadata
- query- The query
- Returns:
- The encoded query
 
- 
isAliasForBatchprotected abstract boolean isAliasForBatch(PersistentEntity persistentEntity, io.micronaut.core.annotation.AnnotationMetadata annotationMetadata) Should aliases be used in batch statements.- Parameters:
- persistentEntity- the persistent entity
- annotationMetadata- the method annotation metadata
- Returns:
- True if they should
 
- 
appendDeleteClauseAppend the delete clause.- Parameters:
- queryString- The query string
- Returns:
- The delete clause
 
- 
buildOrderBy@NonNull public @NonNull QueryResult buildOrderBy(@NonNull @NonNull PersistentEntity entity, @NonNull @NonNull Sort sort) Description copied from interface:QueryBuilderEncode the given query into the encoded query instance.- Specified by:
- buildOrderByin interface- QueryBuilder
- Parameters:
- entity- The root entity
- sort- The sort
- Returns:
- The encoded query
 
- 
buildOrderBy@NonNull public @NonNull QueryResult buildOrderBy(String query, @NonNull @NonNull PersistentEntity entity, @NonNull @NonNull io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, @NonNull @NonNull Sort sort) Encode the given query into the encoded query instance.- Parameters:
- query- The query
- entity- The root entity
- annotationMetadata- The annotation metadata
- sort- The sort
- Returns:
- The encoded query
 
- 
asPathJoin associations and property as path.- Parameters:
- associations- The associations
- property- The property
- Returns:
- joined path
 
- 
traversePersistentPropertiesprotected void traversePersistentProperties(PersistentProperty property, BiConsumer<List<Association>, PersistentProperty> consumer) Traverses persistent properties.- Parameters:
- property- The property to start traversing from
- consumer- The function to invoke on every property
 
- 
traversePersistentPropertiesprotected void traversePersistentProperties(PersistentEntity persistentEntity, BiConsumer<List<Association>, PersistentProperty> consumer) Traverses persistent properties.- Parameters:
- persistentEntity- The persistent entity
- consumer- The function to invoke on every property
 
- 
traversePersistentPropertiesprotected void traversePersistentProperties(PersistentEntity persistentEntity, boolean includeIdentity, boolean includeVersion, BiConsumer<List<Association>, PersistentProperty> consumer) Traverses persistent properties.- Parameters:
- persistentEntity- The persistent entity
- includeIdentity- Should be identifier included
- includeVersion- Should be version included
- consumer- The function to invoke on every property
 
- 
traversePersistentPropertiesprotected void traversePersistentProperties(List<Association> associations, PersistentProperty property, BiConsumer<List<Association>, PersistentProperty> consumerProperty) Traverses persistent properties.- Parameters:
- associations- The association list being traversed with the property
- property- The persistent property
- consumerProperty- The function to invoke on every property
 
- 
newBindingContextprotected BindingParameter.BindingContext newBindingContext(@Nullable @Nullable PersistentPropertyPath ref) Creates new binding parameter context.- Parameters:
- ref- the persistent property reference
- Returns:
- new binding parameter context
 
- 
getDataTransformerReadValueReturns transformed value if the data transformer id defined.- Parameters:
- alias- query table alias
- prop- a property
- Returns:
- optional transformed value
 
- 
getDataTransformerWriteValueReturns transformed value if the data transformer id defined.- Parameters:
- alias- query table alias
- prop- a property
- Returns:
- optional transformed value
 
- 
formatParameterFormat the parameter at the given index.- Parameters:
- index- The parameter
- Returns:
- The index
 
- 
resolveJoinTypeResolves the join type.- Parameters:
- jt- The join type
- Returns:
- The join type.
 
- 
addCriterionHandlerprotected <T extends QueryModel.Criterion> void addCriterionHandler(Class<T> clazz, AbstractSqlLikeQueryBuilder.CriterionHandler<T> handler) Adds criterion handler.- Type Parameters:
- T- The criterion type
- Parameters:
- clazz- The handler class
- handler- The handler
 
- 
getColumnAliasGets column alias if defined as alias field on MappedProperty annotation on the mapping field.- Parameters:
- property- the persisent propert
- Returns:
- column alias if defined, otherwise an empty string
 
- 
checkDialectSupportsJsonEntityIf and whenEntityRepresentationannotation with JSON type is used for the repository method but dialect does not support JSON entity representations this will throwIllegalArgumentException.- Parameters:
- entity- the persistent entity
 
- 
isJsonEntityprotected boolean isJsonEntity(io.micronaut.core.annotation.AnnotationMetadata annotationMetadata, PersistentEntity entity) Checks whetherEntityRepresentationannotation with JSON type is used for the repository method. If current dialect does not support handling JSON entity representations,IllegalArgumentExceptionis thrown.- Parameters:
- annotationMetadata- the annotation metadata
- entity- the persistent entity
- Returns:
- true if EntityRepresentationannotation with JSON type is used for the repository method
 
 
-