Browse Source

Adopt to deprecated `QueryMethod` constructor.

Original pull request: #2049
Closes: #2025
pull/2125/head
Daeho Kwon 8 months ago committed by Jens Schauder
parent
commit
e88f4fe299
No known key found for this signature in database
GPG Key ID: 2BE5D185CD2A1CE6
  1. 7
      spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/query/JdbcQueryMethod.java
  2. 7
      spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/repository/query/R2dbcQueryMethod.java
  3. 2
      spring-data-relational/src/test/java/org/springframework/data/relational/repository/query/CriteriaFactoryUnitTests.java
  4. 2
      spring-data-relational/src/test/java/org/springframework/data/relational/repository/query/ParameterMetadataProviderUnitTests.java

7
spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/query/JdbcQueryMethod.java

@ -67,7 +67,7 @@ public class JdbcQueryMethod extends QueryMethod {
NamedQueries namedQueries, NamedQueries namedQueries,
MappingContext<? extends RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> mappingContext) { MappingContext<? extends RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> mappingContext) {
super(method, metadata, factory); super(method, metadata, factory, JdbcParameters::new);
this.namedQueries = namedQueries; this.namedQueries = namedQueries;
this.method = method; this.method = method;
this.mappingContext = mappingContext; this.mappingContext = mappingContext;
@ -75,11 +75,6 @@ public class JdbcQueryMethod extends QueryMethod {
this.modifyingQuery = AnnotationUtils.findAnnotation(method, Modifying.class) != null; this.modifyingQuery = AnnotationUtils.findAnnotation(method, Modifying.class) != null;
} }
@Override
protected Parameters<?, ?> createParameters(ParametersSource parametersSource) {
return new JdbcParameters(parametersSource);
}
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public RelationalEntityMetadata<?> getEntityInformation() { public RelationalEntityMetadata<?> getEntityInformation() {

7
spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/repository/query/R2dbcQueryMethod.java

@ -83,7 +83,7 @@ public class R2dbcQueryMethod extends QueryMethod {
public R2dbcQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory projectionFactory, public R2dbcQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory projectionFactory,
MappingContext<? extends RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> mappingContext) { MappingContext<? extends RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> mappingContext) {
super(method, metadata, projectionFactory); super(method, metadata, projectionFactory, RelationalParameters::new);
Assert.notNull(mappingContext, "MappingContext must not be null"); Assert.notNull(mappingContext, "MappingContext must not be null");
@ -123,11 +123,6 @@ public class R2dbcQueryMethod extends QueryMethod {
this.lock = Optional.ofNullable(AnnotatedElementUtils.findMergedAnnotation(method, Lock.class)); this.lock = Optional.ofNullable(AnnotatedElementUtils.findMergedAnnotation(method, Lock.class));
} }
@Override
protected RelationalParameters createParameters(ParametersSource parametersSource) {
return new RelationalParameters(parametersSource);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.springframework.data.repository.query.QueryMethod#isCollectionQuery() * @see org.springframework.data.repository.query.QueryMethod#isCollectionQuery()
*/ */

2
spring-data-relational/src/test/java/org/springframework/data/relational/repository/query/CriteriaFactoryUnitTests.java

@ -78,7 +78,7 @@ public class CriteriaFactoryUnitTests {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
return new QueryMethod(method, new DefaultRepositoryMetadata(UserRepository.class), return new QueryMethod(method, new DefaultRepositoryMetadata(UserRepository.class),
new SpelAwareProxyProjectionFactory()); new SpelAwareProxyProjectionFactory(), RelationalParameters::new);
} }
private RelationalParametersParameterAccessor getAccessor(QueryMethod queryMethod, Object... values) { private RelationalParametersParameterAccessor getAccessor(QueryMethod queryMethod, Object... values) {

2
spring-data-relational/src/test/java/org/springframework/data/relational/repository/query/ParameterMetadataProviderUnitTests.java

@ -82,7 +82,7 @@ public class ParameterMetadataProviderUnitTests {
static class RelationalQueryMethod extends QueryMethod { static class RelationalQueryMethod extends QueryMethod {
public RelationalQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory) { public RelationalQueryMethod(Method method, RepositoryMetadata metadata, ProjectionFactory factory) {
super(method, metadata, factory); super(method, metadata, factory, RelationalParameters::new);
} }
} }

Loading…
Cancel
Save