java.lang.Object
org.springframework.data.jdbc.core.convert.QueryMapper
Maps
CriteriaDefinition and Sort objects considering mapping metadata and dialect-specific
conversion.- Since:
- 3.0
- Author:
- Mark Paluch, Jens Schauder, Yan Qiang, Mikhail Fedorov
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classValue object to represent a field and its meta-information.protected static classExtension ofQueryMapper.Fieldto be backed with mapping metadata. -
Constructor Summary
ConstructorsConstructorDescriptionQueryMapper(JdbcConverter converter) Creates a newQueryMapperwith the givenJdbcConverter. -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectconvertValue(Object value, TypeInformation<?> typeInformation) org.springframework.data.relational.core.sql.ConditiongetMappedObject(MapSqlParameterSource parameterSource, org.springframework.data.relational.core.query.CriteriaDefinition criteria, org.springframework.data.relational.core.sql.Table table, org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?> entity) Map aCriteriaDefinitionobject intoConditionand consider value/NULLbindings.List<org.springframework.data.relational.core.sql.OrderByField>getMappedSort(org.springframework.data.relational.core.sql.Table table, Sort sort, org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?> entity) Map theSortobject to apply field name mapping usingthe type to read.protected MappingContext<? extends org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?>,org.springframework.data.relational.core.mapping.RelationalPersistentProperty>
-
Constructor Details
-
QueryMapper
Creates a newQueryMapperwith the givenJdbcConverter.- Parameters:
converter- must not be null.
-
-
Method Details
-
getMappedSort
public List<org.springframework.data.relational.core.sql.OrderByField> getMappedSort(org.springframework.data.relational.core.sql.Table table, Sort sort, @Nullable org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?> entity) Map theSortobject to apply field name mapping usingthe type to read.- Parameters:
sort- must not be null.entity- relatedRelationalPersistentEntity, can be null.- Returns:
- a List of
OrderByFieldobjects guaranteed to be not null.
-
getMappedObject
public org.springframework.data.relational.core.sql.Condition getMappedObject(MapSqlParameterSource parameterSource, org.springframework.data.relational.core.query.CriteriaDefinition criteria, org.springframework.data.relational.core.sql.Table table, @Nullable org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?> entity) Map aCriteriaDefinitionobject intoConditionand consider value/NULLbindings.- Parameters:
parameterSource- bind parameterSource object, must not be null.criteria- criteria definition to map, must not be null.table- must not be null.entity- relatedRelationalPersistentEntity, can be null.- Returns:
- the mapped
Condition.
-
convertValue
-
getMappingContext
protected MappingContext<? extends org.springframework.data.relational.core.mapping.RelationalPersistentEntity<?>,org.springframework.data.relational.core.mapping.RelationalPersistentProperty> getMappingContext()
-