@@ -43,7 +43,6 @@ import org.springframework.data.r2dbc.dialect.DialectResolver;
|
||||
import org.springframework.data.r2dbc.dialect.R2dbcDialect;
|
||||
import org.springframework.data.r2dbc.mapping.R2dbcMappingContext;
|
||||
import org.springframework.data.relational.RelationalManagedTypes;
|
||||
import org.springframework.data.relational.core.conversion.BasicRelationalConverter;
|
||||
import org.springframework.data.relational.core.mapping.DefaultNamingStrategy;
|
||||
import org.springframework.data.relational.core.mapping.NamingStrategy;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
|
||||
@@ -432,15 +432,6 @@ public interface StatementMapper {
|
||||
return this.table;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @deprecated since 1.1, use {@link #getSelectList()} instead.
|
||||
*/
|
||||
@Deprecated
|
||||
public List<String> getProjectedFields() {
|
||||
return Collections.unmodifiableList(this.projectedFields);
|
||||
}
|
||||
|
||||
public List<Expression> getSelectList() {
|
||||
return Collections.unmodifiableList(selectList);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ import org.springframework.data.r2dbc.dialect.R2dbcDialect;
|
||||
import org.springframework.data.relational.core.dialect.Escaper;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
|
||||
import org.springframework.data.relational.core.query.Criteria;
|
||||
import org.springframework.data.relational.core.query.CriteriaDefinition;
|
||||
import org.springframework.data.relational.core.query.CriteriaDefinition.Comparator;
|
||||
import org.springframework.data.relational.core.query.ValueFunction;
|
||||
@@ -97,35 +96,6 @@ public class QueryMapper {
|
||||
return identifier.toSql(this.dialect.getIdentifierProcessing());
|
||||
}
|
||||
|
||||
/**
|
||||
* Map the {@link Sort} object to apply field name mapping using {@link Class the type to read}.
|
||||
*
|
||||
* @param sort must not be {@literal null}.
|
||||
* @param entity related {@link RelationalPersistentEntity}, can be {@literal null}.
|
||||
* @return
|
||||
* @deprecated without replacement.
|
||||
*/
|
||||
@Deprecated(since = "3.2", forRemoval = true)
|
||||
public Sort getMappedObject(Sort sort, @Nullable RelationalPersistentEntity<?> entity) {
|
||||
|
||||
if (entity == null) {
|
||||
return sort;
|
||||
}
|
||||
|
||||
List<Sort.Order> mappedOrder = new ArrayList<>();
|
||||
|
||||
for (Sort.Order order : sort) {
|
||||
|
||||
SqlSort.validate(order);
|
||||
|
||||
Field field = createPropertyField(entity, SqlIdentifier.unquoted(order.getProperty()), this.mappingContext);
|
||||
mappedOrder.add(
|
||||
Sort.Order.by(toSql(field.getMappedColumnName())).with(order.getNullHandling()).with(order.getDirection()));
|
||||
}
|
||||
|
||||
return Sort.by(mappedOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map the {@link Sort} object to apply field name mapping using {@link Class the type to read}.
|
||||
*
|
||||
@@ -229,35 +199,6 @@ public class QueryMapper {
|
||||
return new BoundCondition(bindings, mapped);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map a {@link Criteria} object into {@link Condition} and consider value/{@code NULL} {@link Bindings}.
|
||||
*
|
||||
* @param markers bind markers object, must not be {@literal null}.
|
||||
* @param criteria criteria definition to map, must not be {@literal null}.
|
||||
* @param table must not be {@literal null}.
|
||||
* @param entity related {@link RelationalPersistentEntity}, can be {@literal null}.
|
||||
* @return the mapped {@link BoundCondition}.
|
||||
* @deprecated since 1.1.
|
||||
*/
|
||||
@Deprecated
|
||||
public BoundCondition getMappedObject(BindMarkers markers, Criteria criteria, Table table,
|
||||
@Nullable RelationalPersistentEntity<?> entity) {
|
||||
|
||||
Assert.notNull(markers, "BindMarkers must not be null");
|
||||
Assert.notNull(criteria, "Criteria must not be null");
|
||||
Assert.notNull(table, "Table must not be null");
|
||||
|
||||
MutableBindings bindings = new MutableBindings(markers);
|
||||
|
||||
if (criteria.isEmpty()) {
|
||||
throw new IllegalArgumentException("Cannot map empty Criteria");
|
||||
}
|
||||
|
||||
Condition mapped = unroll(criteria, table, entity, bindings);
|
||||
|
||||
return new BoundCondition(bindings, mapped);
|
||||
}
|
||||
|
||||
private Condition unroll(CriteriaDefinition criteria, Table table, @Nullable RelationalPersistentEntity<?> entity,
|
||||
MutableBindings bindings) {
|
||||
|
||||
|
||||
@@ -427,26 +427,6 @@ class QueryMapperUnitTests {
|
||||
assertThat(bindings.getCondition()).hasToString("person.name LIKE ?[$1]");
|
||||
}
|
||||
|
||||
@Test // gh-64
|
||||
void shouldMapSort() {
|
||||
|
||||
Sort sort = Sort.by(desc("alternative"));
|
||||
|
||||
Sort mapped = mapper.getMappedObject(sort, mapper.getMappingContext().getRequiredPersistentEntity(Person.class));
|
||||
|
||||
assertThat(mapped.getOrderFor("another_name")).isEqualTo(desc("another_name"));
|
||||
assertThat(mapped.getOrderFor("alternative")).isNull();
|
||||
}
|
||||
|
||||
@Test // gh-369
|
||||
void mapSortForPropertyPathInPrimitiveShouldFallBackToColumnName() {
|
||||
|
||||
Sort sort = Sort.by(desc("alternative_name"));
|
||||
|
||||
Sort mapped = mapper.getMappedObject(sort, mapper.getMappingContext().getRequiredPersistentEntity(Person.class));
|
||||
assertThat(mapped.getOrderFor("alternative_name")).isEqualTo(desc("alternative_name"));
|
||||
}
|
||||
|
||||
@Test // GH-1507
|
||||
public void shouldMapSortWithUnknownField() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user