Remove deprecated code.

Original pull request #1869
This commit is contained in:
Jens Schauder
2024-08-29 14:02:01 +02:00
parent c8b9697c51
commit 848ffee253
38 changed files with 11 additions and 1589 deletions

View File

@@ -265,22 +265,6 @@ public interface JdbcAggregateOperations {
*/
<T> void delete(T aggregateRoot);
/**
* Delete an aggregate identified by its aggregate root.
*
* @param aggregateRoot to delete. Must not be {@code null}.
* @param domainType the type of the aggregate root. Must not be {@code null}.
* @param <T> the type of the aggregate root.
* @throws org.springframework.dao.OptimisticLockingFailureException when {@literal T} has a version attribute and the
* version attribute of the provided entity does not match the version attribute in the database, or when
* there is no aggregate root with matching id. In other cases a NOOP delete is silently ignored.
* @deprecated since 3.0 use {@link #delete(Object)} instead
*/
@Deprecated(since = "3.0")
default <T> void delete(T aggregateRoot, Class<T> domainType) {
delete(aggregateRoot);
}
/**
* Delete all aggregates of a given type.
*
@@ -295,21 +279,4 @@ public interface JdbcAggregateOperations {
* @param <T> the type of the aggregate roots.
*/
<T> void deleteAll(Iterable<? extends T> aggregateRoots);
/**
* Delete all aggregates identified by their aggregate roots.
*
* @param aggregateRoots to delete. Must not be {@code null}.
* @param domainType type of the aggregate roots to be deleted. Must not be {@code null}.
* @param <T> the type of the aggregate roots.
* @throws org.springframework.dao.OptimisticLockingFailureException when {@literal T} has a version attribute and for
* at least on entity the version attribute of the entity does not match the version attribute in the
* database, or when there is no aggregate root with matching id. In other cases a NOOP delete is silently
* ignored.
* @deprecated since 3.0 use {@link #deleteAll(Iterable)} instead.
*/
@Deprecated(since = "3.0")
default <T> void deleteAll(Iterable<? extends T> aggregateRoots, Class<T> domainType) {
deleteAll(aggregateRoots);
}
}

View File

@@ -1,77 +0,0 @@
/*
* Copyright 2023-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.jdbc.core.convert;
import org.springframework.data.convert.CustomConversions;
import org.springframework.data.mapping.context.MappingContext;
import org.springframework.data.relational.core.conversion.RelationalConverter;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
/**
* {@link RelationalConverter} that uses a {@link MappingContext} to apply conversion of relational values to property
* values.
* <p>
* Conversion is configurable by providing a customized {@link CustomConversions}.
*
* @author Mark Paluch
* @since 1.1
* @deprecated since 3.2, use {@link MappingJdbcConverter} instead as the naming suggests a limited scope of
* functionality.
*/
@Deprecated(since = "3.2")
public class BasicJdbcConverter extends MappingJdbcConverter {
/**
* Creates a new {@link BasicJdbcConverter} given {@link MappingContext} and a {@link JdbcTypeFactory#unsupported()
* no-op type factory} throwing {@link UnsupportedOperationException} on type creation. Use
* {@link #BasicJdbcConverter(RelationalMappingContext, RelationResolver, CustomConversions, JdbcTypeFactory, IdentifierProcessing)}
* (MappingContext, RelationResolver, JdbcTypeFactory)} to convert arrays and large objects into JDBC-specific types.
*
* @param context must not be {@literal null}.
* @param relationResolver used to fetch additional relations from the database. Must not be {@literal null}.
*/
public BasicJdbcConverter(RelationalMappingContext context, RelationResolver relationResolver) {
super(context, relationResolver);
}
/**
* Creates a new {@link BasicJdbcConverter} given {@link MappingContext}.
*
* @param context must not be {@literal null}.
* @param relationResolver used to fetch additional relations from the database. Must not be {@literal null}.
* @param typeFactory must not be {@literal null}
* @since 3.2
*/
public BasicJdbcConverter(RelationalMappingContext context, RelationResolver relationResolver,
CustomConversions conversions, JdbcTypeFactory typeFactory) {
super(context, relationResolver, conversions, typeFactory);
}
/**
* Creates a new {@link BasicJdbcConverter} given {@link MappingContext}.
*
* @param context must not be {@literal null}.
* @param relationResolver used to fetch additional relations from the database. Must not be {@literal null}.
* @param typeFactory must not be {@literal null}
* @param identifierProcessing must not be {@literal null}
* @since 2.0
*/
public BasicJdbcConverter(RelationalMappingContext context, RelationResolver relationResolver,
CustomConversions conversions, JdbcTypeFactory typeFactory, IdentifierProcessing identifierProcessing) {
super(context, relationResolver, conversions, typeFactory);
}
}

View File

@@ -1,79 +0,0 @@
/*
* Copyright 2022-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.data.jdbc.core.convert;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.lang.Nullable;
/**
* Counterpart to {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations} containing methods for
* performing batch updates with generated keys.
*
* @author Chirag Tailor
* @author Mark Paluch
* @since 2.4
* @deprecated since 3.2. Use {@link org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations#batchUpdate}
* methods instead.
*/
@Deprecated(since = "3.2")
public class BatchJdbcOperations {
private final NamedParameterJdbcOperations jdbcOperations;
public BatchJdbcOperations(JdbcOperations jdbcOperations) {
this.jdbcOperations = new NamedParameterJdbcTemplate(jdbcOperations);
}
/**
* Execute a batch using the supplied SQL statement with the batch of supplied arguments, returning generated keys.
*
* @param sql the SQL statement to execute
* @param batchArgs the array of {@link SqlParameterSource} containing the batch of arguments for the query
* @param generatedKeyHolder a {@link KeyHolder} that will hold the generated keys
* @return an array containing the numbers of rows affected by each update in the batch (may also contain special
* JDBC-defined negative values for affected rows such as
* {@link java.sql.Statement#SUCCESS_NO_INFO}/{@link java.sql.Statement#EXECUTE_FAILED})
* @throws org.springframework.dao.DataAccessException if there is any problem issuing the update
* @see org.springframework.jdbc.support.GeneratedKeyHolder
* @since 2.4
*/
int[] batchUpdate(String sql, SqlParameterSource[] batchArgs, KeyHolder generatedKeyHolder) {
return jdbcOperations.batchUpdate(sql, batchArgs, generatedKeyHolder);
}
/**
* Execute a batch using the supplied SQL statement with the batch of supplied arguments, returning generated keys.
*
* @param sql the SQL statement to execute
* @param batchArgs the array of {@link SqlParameterSource} containing the batch of arguments for the query
* @param generatedKeyHolder a {@link KeyHolder} that will hold the generated keys
* @param keyColumnNames names of the columns that will have keys generated for them
* @return an array containing the numbers of rows affected by each update in the batch (may also contain special
* JDBC-defined negative values for affected rows such as
* {@link java.sql.Statement#SUCCESS_NO_INFO}/{@link java.sql.Statement#EXECUTE_FAILED})
* @throws org.springframework.dao.DataAccessException if there is any problem issuing the update
* @see org.springframework.jdbc.support.GeneratedKeyHolder
* @since 2.4
*/
int[] batchUpdate(String sql, SqlParameterSource[] batchArgs, KeyHolder generatedKeyHolder,
@Nullable String[] keyColumnNames) {
return jdbcOperations.batchUpdate(sql, batchArgs, generatedKeyHolder, keyColumnNames);
}
}

View File

@@ -19,7 +19,6 @@ import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.data.relational.core.mapping.AggregatePath;
import org.springframework.data.relational.core.mapping.PersistentPropertyPathExtension;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.domain.RowDocument;
import org.springframework.jdbc.core.RowMapper;
@@ -43,19 +42,6 @@ public class EntityRowMapper<T> implements RowMapper<T> {
private final JdbcConverter converter;
private final @Nullable Identifier identifier;
/**
* @deprecated use {@link EntityRowMapper#EntityRowMapper(AggregatePath, JdbcConverter, Identifier)} instead
*/
@Deprecated(since = "3.2", forRemoval = true)
@SuppressWarnings("unchecked")
public EntityRowMapper(PersistentPropertyPathExtension path, JdbcConverter converter, Identifier identifier) {
this.entity = (RelationalPersistentEntity<T>) path.getLeafEntity();
this.path = path.getAggregatePath();
this.converter = converter;
this.identifier = identifier;
}
@SuppressWarnings("unchecked")
public EntityRowMapper(AggregatePath path, JdbcConverter converter, Identifier identifier) {

View File

@@ -41,18 +41,6 @@ public class InsertStrategyFactory {
this.dialect = dialect;
}
/**
* Constructor with additional {@link BatchJdbcOperations} constructor.
*
* @deprecated since 3.2, use
* {@link InsertStrategyFactory#InsertStrategyFactory(NamedParameterJdbcOperations, Dialect)} instead.
*/
@Deprecated(since = "3.2")
public InsertStrategyFactory(NamedParameterJdbcOperations namedParameterJdbcOperations,
BatchJdbcOperations batchJdbcOperations, Dialect dialect) {
this(namedParameterJdbcOperations, dialect);
}
/**
* @param idValueSource the {@link IdValueSource} for the insert.
* @param idColumn the identifier for the id, if an id is expected to be generated. May be {@code null}.

View File

@@ -15,15 +15,11 @@
*/
package org.springframework.data.jdbc.core.convert;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.SQLType;
import org.springframework.data.jdbc.core.mapping.JdbcValue;
import org.springframework.data.relational.core.conversion.RelationalConverter;
import org.springframework.data.relational.core.mapping.PersistentPropertyPathExtension;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.domain.RowDocument;
import org.springframework.data.util.TypeInformation;
@@ -65,48 +61,6 @@ public interface JdbcConverter extends RelationalConverter {
*/
JdbcValue writeJdbcValue(@Nullable Object value, TypeInformation<?> type, SQLType sqlType);
/**
* Read the current row from {@link ResultSet} to an {@link RelationalPersistentEntity#getType() entity}.
*
* @param entity the persistent entity type.
* @param resultSet the {@link ResultSet} to read from.
* @param key primary key.
* @param <T>
* @return
* @deprecated since 3.2, use {@link #readAndResolve(Class, RowDocument, Identifier)} instead.
*/
@Deprecated(since = "3.2")
default <T> T mapRow(RelationalPersistentEntity<T> entity, ResultSet resultSet, Object key) {
try {
return readAndResolve(entity.getType(), RowDocumentResultSetExtractor.toRowDocument(resultSet));
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
/**
* Read the current row from {@link ResultSet} to an {@link PersistentPropertyPathExtension#getActualType() entity}.
*
* @param path path to the owning property.
* @param resultSet the {@link ResultSet} to read from.
* @param identifier entity identifier.
* @param key primary key.
* @param <T>
* @return
* @deprecated use {@link #readAndResolve(Class, RowDocument, Identifier)} instead.
*/
@SuppressWarnings("unchecked")
@Deprecated(since = "3.2", forRemoval = true)
default <T> T mapRow(PersistentPropertyPathExtension path, ResultSet resultSet, Identifier identifier, Object key) {
try {
return (T) readAndResolve(path.getRequiredLeafEntity().getTypeInformation(),
RowDocumentResultSetExtractor.toRowDocument(resultSet), identifier);
} catch (SQLException e) {
throw new RuntimeException(e);
}
};
/**
* Read a {@link RowDocument} into the requested {@link Class aggregate type} and resolve references by looking these
* up from {@link RelationResolver}.

View File

@@ -16,7 +16,6 @@
package org.springframework.data.jdbc.core.convert;
import org.springframework.data.relational.core.mapping.AggregatePath;
import org.springframework.data.relational.core.mapping.PersistentPropertyPathExtension;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
@@ -38,17 +37,6 @@ public class JdbcIdentifierBuilder {
return new JdbcIdentifierBuilder(Identifier.empty());
}
/**
* Creates ParentKeys with backreference for the given path and value of the parents id.
*
* @deprecated Use {@link #forBackReferences(JdbcConverter, AggregatePath, Object)} instead.
*/
@Deprecated(since = "3.2", forRemoval = true)
public static JdbcIdentifierBuilder forBackReferences(JdbcConverter converter, PersistentPropertyPathExtension path,
@Nullable Object value) {
return forBackReferences(converter, path.getAggregatePath(), value);
}
/**
* Creates ParentKeys with backreference for the given path and value of the parents id.
*/
@@ -64,20 +52,6 @@ public class JdbcIdentifierBuilder {
return new JdbcIdentifierBuilder(identifier);
}
/**
* Adds a qualifier to the identifier to build. A qualifier is a map key or a list index.
*
* @param path path to the map that gets qualified by {@code value}. Must not be {@literal null}.
* @param value map key or list index qualifying the map identified by {@code path}. Must not be {@literal null}.
* @return this builder. Guaranteed to be not {@literal null}.
*/
@Deprecated
public JdbcIdentifierBuilder withQualifier(PersistentPropertyPathExtension path, Object value) {
return withQualifier(path.getAggregatePath(), value);
}
/**
* Adds a qualifier to the identifier to build. A qualifier is a map key or a list index.
*
@@ -90,7 +64,8 @@ public class JdbcIdentifierBuilder {
Assert.notNull(path, "Path must not be null");
Assert.notNull(value, "Value must not be null");
identifier = identifier.withPart(path.getTableInfo().qualifierColumnInfo().name(), value, path.getTableInfo().qualifierColumnType());
identifier = identifier.withPart(path.getTableInfo().qualifierColumnInfo().name(), value,
path.getTableInfo().qualifierColumnType());
return this;
}

View File

@@ -61,23 +61,6 @@ public class QueryMapper {
private final JdbcConverter converter;
private final MappingContext<? extends RelationalPersistentEntity<?>, RelationalPersistentProperty> mappingContext;
/**
* Creates a new {@link QueryMapper} with the given {@link JdbcConverter}.
*
* @param dialect must not be {@literal null}.
* @param converter must not be {@literal null}.
* @deprecated use {@link QueryMapper(JdbcConverter)} instead.
*/
@Deprecated(since="3.2")
public QueryMapper(Dialect dialect, JdbcConverter converter) {
Assert.notNull(dialect, "Dialect must not be null");
Assert.notNull(converter, "JdbcConverter must not be null");
this.converter = converter;
this.mappingContext = converter.getMappingContext();
}
/**
* Creates a new {@link QueryMapper} with the given {@link JdbcConverter}.
*

View File

@@ -47,15 +47,7 @@ import org.springframework.util.Assert;
public class SqlParametersFactory {
private final RelationalMappingContext context;
private final JdbcConverter converter;
/**
* @deprecated use {@link SqlParametersFactory(RelationalMappingContext, JdbcConverter)} instead.
*/
@Deprecated(since = "3.1", forRemoval = true)
public SqlParametersFactory(RelationalMappingContext context, JdbcConverter converter, Dialect dialect) {
this(context, converter);
}
/**
* @since 3.1
*/

View File

@@ -36,9 +36,7 @@ import org.springframework.data.relational.core.dialect.Dialect;
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
import org.springframework.data.relational.core.query.Query;
import org.springframework.data.relational.core.sql.IdentifierProcessing;
import org.springframework.data.relational.core.sql.LockMode;
import org.springframework.data.relational.core.sql.SqlIdentifier;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
import org.springframework.util.Assert;
@@ -102,8 +100,7 @@ public class MyBatisDataAccessStrategy implements DataAccessStrategy {
// the DefaultDataAccessStrategy needs a reference to the returned DataAccessStrategy. This creates a dependency
// cycle. In order to create it, we need something that allows to defer closing the cycle until all the elements are
// created. That is the purpose of the DelegatingAccessStrategy.
MyBatisDataAccessStrategy myBatisDataAccessStrategy = new MyBatisDataAccessStrategy(sqlSession,
dialect.getIdentifierProcessing());
MyBatisDataAccessStrategy myBatisDataAccessStrategy = new MyBatisDataAccessStrategy(sqlSession);
myBatisDataAccessStrategy.setNamespaceStrategy(namespaceStrategy);
return new CascadingDataAccessStrategy(
@@ -120,15 +117,6 @@ public class MyBatisDataAccessStrategy implements DataAccessStrategy {
* to create such a {@link DataAccessStrategy}.
*
* @param sqlSession Must be non {@literal null}.
* @deprecated because identifierProcessing now will not be considered in the process of applying it to
* {@link SqlIdentifier}, use {@link MyBatisDataAccessStrategy(SqlSession)} constructor instead
*/
@Deprecated(since = "3.1", forRemoval = true)
public MyBatisDataAccessStrategy(SqlSession sqlSession, IdentifierProcessing identifierProcessing) {
this(sqlSession);
}
/**
* @since 3.1
*/
public MyBatisDataAccessStrategy(SqlSession sqlSession) {

View File

@@ -72,23 +72,6 @@ public abstract class AbstractJdbcQuery implements RepositoryQuery {
return queryMethod;
}
/**
* Creates a {@link JdbcQueryExecution} given a {@link JdbcQueryMethod}, and ac{@link ResultSetExtractor} or a
* {@link RowMapper}. Prefers the given {@link ResultSetExtractor} over {@link RowMapper}.
*
* @param queryMethod must not be {@literal null}.
* @param extractor must not be {@literal null}.
* @param rowMapper must not be {@literal null}.
* @return a JdbcQueryExecution appropriate for {@literal queryMethod}. Guaranteed to be not {@literal null}.
* @deprecated use {@link #createReadingQueryExecution(ResultSetExtractor, RowMapper)} instead.
*/
@Deprecated(since = "3.1", forRemoval = true)
// a better name would be createReadingQueryExecution
JdbcQueryExecution<?> getQueryExecution(JdbcQueryMethod queryMethod,
@Nullable ResultSetExtractor<?> extractor, RowMapper<?> rowMapper) {
return createReadingQueryExecution(extractor, () -> rowMapper);
}
/**
* Creates a {@link JdbcQueryExecution} given a {@link ResultSetExtractor} or a {@link RowMapper}. Prefers the given
* {@link ResultSetExtractor} over {@link RowMapper}.