committed by
Mark Paluch
parent
1ef4182907
commit
5d3d38e8ef
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2025 the original author or authors.
|
||||
* Copyright 2025 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.
|
||||
@@ -23,32 +23,38 @@ import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Abstract {@link RowMapper} that delegates the actual mapping logic to a {@link AbstractDelegatingRowMapper#delegate delegate}
|
||||
* Abstract {@link RowMapper} that delegates the actual mapping logic to a {@link AbstractDelegatingRowMapper#delegate
|
||||
* delegate}
|
||||
*
|
||||
* @author Mikhail Polivakha
|
||||
* @since 4.0
|
||||
*/
|
||||
public abstract class AbstractDelegatingRowMapper<T> implements RowMapper<T> {
|
||||
|
||||
private final RowMapper<T> delegate;
|
||||
private final RowMapper<T> delegate;
|
||||
|
||||
protected AbstractDelegatingRowMapper(RowMapper<T> delegate) {
|
||||
Assert.notNull(delegate, "Delegating RowMapper cannot be null");
|
||||
protected AbstractDelegatingRowMapper(RowMapper<T> delegate) {
|
||||
|
||||
this.delegate = delegate;
|
||||
}
|
||||
Assert.notNull(delegate, "Delegating RowMapper cannot be null");
|
||||
|
||||
@Override
|
||||
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
T intermediate = delegate.mapRow(rs, rowNum);
|
||||
return postProcessMapping(intermediate);
|
||||
}
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
/**
|
||||
* The post-processing callback for implementations.
|
||||
*
|
||||
* @return the mapped entity after applying post-processing logic
|
||||
*/
|
||||
protected T postProcessMapping(@Nullable T object) {
|
||||
return object;
|
||||
}
|
||||
@Override
|
||||
@Nullable
|
||||
public T mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
|
||||
T intermediate = delegate.mapRow(rs, rowNum);
|
||||
return postProcessMapping(intermediate);
|
||||
}
|
||||
|
||||
/**
|
||||
* The post-processing callback for implementations.
|
||||
*
|
||||
* @return the mapped entity after applying post-processing logic
|
||||
*/
|
||||
@Nullable
|
||||
protected T postProcessMapping(@Nullable T object) {
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.data.jdbc.repository.query;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Stream;
|
||||
@@ -156,7 +154,7 @@ public abstract class AbstractJdbcQuery implements RepositoryQuery {
|
||||
* @deprecated Use {@link org.springframework.data.jdbc.repository.query.RowMapperFactory} instead
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "3.4.4")
|
||||
public interface RowMapperFactory extends org.springframework.data.jdbc.repository.query.RowMapperFactory { }
|
||||
public interface RowMapperFactory extends org.springframework.data.jdbc.repository.query.RowMapperFactory {}
|
||||
|
||||
/**
|
||||
* Delegating {@link RowMapper} that reads a row into {@code T} and converts it afterwards into {@code Object}.
|
||||
@@ -166,8 +164,8 @@ public abstract class AbstractJdbcQuery implements RepositoryQuery {
|
||||
* @deprecated use {@link org.springframework.data.jdbc.repository.query.ConvertingRowMapper} instead
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "3.4.4")
|
||||
protected static class ConvertingRowMapper<T> extends
|
||||
org.springframework.data.jdbc.repository.query.ConvertingRowMapper {
|
||||
protected static class ConvertingRowMapper<T>
|
||||
extends org.springframework.data.jdbc.repository.query.ConvertingRowMapper {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public ConvertingRowMapper(RowMapper<T> delegate, Converter<Object, Object> converter) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2025 the original author or authors.
|
||||
* Copyright 2025 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.
|
||||
@@ -25,35 +25,41 @@ import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Delegating {@link RowMapper} implementation that applies post-processing logic
|
||||
* after the {@link RowMapper#mapRow(ResultSet, int)}. In particular, it emits the
|
||||
* {@link AfterConvertEvent} event and invokes the {@link AfterConvertCallback} callbacks.
|
||||
* Delegating {@link RowMapper} implementation that applies post-processing logic after the
|
||||
* {@link RowMapper#mapRow(ResultSet, int)}. In particular, it emits the {@link AfterConvertEvent} event and invokes the
|
||||
* {@link AfterConvertCallback} callbacks.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Mikhail Polivakha
|
||||
* @since 4.0
|
||||
*/
|
||||
public class CallbackCapableRowMapper<T> extends AbstractDelegatingRowMapper<T> {
|
||||
|
||||
private final ApplicationEventPublisher publisher;
|
||||
private final @Nullable EntityCallbacks callbacks;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
private final @Nullable EntityCallbacks callbacks;
|
||||
|
||||
public CallbackCapableRowMapper(RowMapper<T> delegate, ApplicationEventPublisher publisher, @Nullable EntityCallbacks callbacks) {
|
||||
super(delegate);
|
||||
this.publisher = publisher;
|
||||
this.callbacks = callbacks;
|
||||
}
|
||||
public CallbackCapableRowMapper(RowMapper<T> delegate, ApplicationEventPublisher publisher,
|
||||
@Nullable EntityCallbacks callbacks) {
|
||||
|
||||
@Override
|
||||
public T postProcessMapping(@Nullable T object) {
|
||||
if (object != null) {
|
||||
super(delegate);
|
||||
|
||||
publisher.publishEvent(new AfterConvertEvent<>(object));
|
||||
this.publisher = publisher;
|
||||
this.callbacks = callbacks;
|
||||
}
|
||||
|
||||
if (callbacks != null) {
|
||||
return callbacks.callback(AfterConvertCallback.class, object);
|
||||
}
|
||||
@Override
|
||||
@Nullable
|
||||
public T postProcessMapping(@Nullable T object) {
|
||||
|
||||
}
|
||||
return object;
|
||||
}
|
||||
if (object != null) {
|
||||
|
||||
publisher.publishEvent(new AfterConvertEvent<>(object));
|
||||
|
||||
if (callbacks != null) {
|
||||
return callbacks.callback(AfterConvertCallback.class, object);
|
||||
}
|
||||
|
||||
}
|
||||
return object;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2025 the original author or authors.
|
||||
* Copyright 2025 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.
|
||||
@@ -20,24 +20,26 @@ import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Delegating {@link RowMapper} that reads a row into {@code T} and converts it afterwards into {@code Object}.
|
||||
* Delegating {@link RowMapper} that reads a row into {@code T} and converts it afterward into {@code Object}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Mikhail Polivakha
|
||||
*
|
||||
* @since 2.3
|
||||
* @since 4.0
|
||||
*/
|
||||
public class ConvertingRowMapper extends AbstractDelegatingRowMapper<Object> {
|
||||
|
||||
private final Converter<Object, Object> converter;
|
||||
private final Converter<Object, Object> converter;
|
||||
|
||||
public ConvertingRowMapper(RowMapper<Object> delegate, Converter<Object, Object> converter) {
|
||||
super(delegate);
|
||||
this.converter = converter;
|
||||
}
|
||||
public ConvertingRowMapper(RowMapper<Object> delegate, Converter<Object, Object> converter) {
|
||||
|
||||
@Override
|
||||
public Object postProcessMapping(@Nullable Object object) {
|
||||
return object != null ? converter.convert(object) : null;
|
||||
}
|
||||
super(delegate);
|
||||
|
||||
this.converter = converter;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Object postProcessMapping(@Nullable Object object) {
|
||||
return object != null ? converter.convert(object) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,64 +27,63 @@ import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.jdbc.core.SingleColumnRowMapper;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link RowMapperFactory}. Honors the custom mappings defined
|
||||
* in {@link QueryMappingConfiguration}.
|
||||
* Default implementation of {@link RowMapperFactory}. Honors the custom mappings defined in
|
||||
* {@link QueryMappingConfiguration}.
|
||||
* <p>
|
||||
* This implementation is not capable of loading the {@link RowMapper} or {@link ResultSetExtractor}
|
||||
* by reference via corresponding methods from {@link RowMapperFactory}.
|
||||
* This implementation is not capable of loading the {@link RowMapper} or {@link ResultSetExtractor} by reference via
|
||||
* corresponding methods from {@link RowMapperFactory}.
|
||||
*
|
||||
* @implNote Public APIs of this class are thread-safe.
|
||||
* @author Mikhail Polivakha
|
||||
* @since 4.0
|
||||
*/
|
||||
public class DefaultRowMapperFactory implements RowMapperFactory {
|
||||
|
||||
private final RelationalMappingContext context;
|
||||
private final JdbcConverter converter;
|
||||
private final QueryMappingConfiguration queryMappingConfiguration;
|
||||
private final EntityCallbacks entityCallbacks;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
private final RelationalMappingContext context;
|
||||
private final JdbcConverter converter;
|
||||
private final QueryMappingConfiguration queryMappingConfiguration;
|
||||
private final EntityCallbacks entityCallbacks;
|
||||
private final ApplicationEventPublisher publisher;
|
||||
|
||||
public DefaultRowMapperFactory(
|
||||
RelationalMappingContext context,
|
||||
JdbcConverter converter,
|
||||
QueryMappingConfiguration queryMappingConfiguration,
|
||||
EntityCallbacks entityCallbacks,
|
||||
ApplicationEventPublisher publisher
|
||||
) {
|
||||
this.context = context;
|
||||
this.converter = converter;
|
||||
this.queryMappingConfiguration = queryMappingConfiguration;
|
||||
this.entityCallbacks = entityCallbacks;
|
||||
this.publisher = publisher;
|
||||
}
|
||||
public DefaultRowMapperFactory(RelationalMappingContext context, JdbcConverter converter,
|
||||
QueryMappingConfiguration queryMappingConfiguration, EntityCallbacks entityCallbacks,
|
||||
ApplicationEventPublisher publisher) {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public RowMapper<Object> create(Class<?> returnedObjectType) {
|
||||
this.context = context;
|
||||
this.converter = converter;
|
||||
this.queryMappingConfiguration = queryMappingConfiguration;
|
||||
this.entityCallbacks = entityCallbacks;
|
||||
this.publisher = publisher;
|
||||
}
|
||||
|
||||
RelationalPersistentEntity<?> persistentEntity = context.getPersistentEntity(returnedObjectType);
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public RowMapper<Object> create(Class<?> returnedObjectType) {
|
||||
|
||||
if (persistentEntity == null) {
|
||||
return (RowMapper<Object>) SingleColumnRowMapper.newInstance(returnedObjectType,
|
||||
converter.getConversionService());
|
||||
}
|
||||
RelationalPersistentEntity<?> persistentEntity = context.getPersistentEntity(returnedObjectType);
|
||||
|
||||
return (RowMapper<Object>) determineDefaultMapper(returnedObjectType);
|
||||
}
|
||||
if (persistentEntity == null) {
|
||||
|
||||
private RowMapper<?> determineDefaultMapper(Class<?> returnedObjectType) {
|
||||
return (RowMapper<Object>) SingleColumnRowMapper.newInstance(returnedObjectType,
|
||||
converter.getConversionService());
|
||||
}
|
||||
|
||||
RowMapper<?> configuredQueryMapper = queryMappingConfiguration.getRowMapper(returnedObjectType);
|
||||
return (RowMapper<Object>) determineDefaultMapper(returnedObjectType);
|
||||
}
|
||||
|
||||
if (configuredQueryMapper != null) {
|
||||
return configuredQueryMapper;
|
||||
}
|
||||
private RowMapper<?> determineDefaultMapper(Class<?> returnedObjectType) {
|
||||
|
||||
EntityRowMapper<?> defaultEntityRowMapper = new EntityRowMapper<>( //
|
||||
context.getRequiredPersistentEntity(returnedObjectType), //
|
||||
converter //
|
||||
);
|
||||
RowMapper<?> configuredQueryMapper = queryMappingConfiguration.getRowMapper(returnedObjectType);
|
||||
|
||||
return new CallbackCapableRowMapper<>(defaultEntityRowMapper, publisher, entityCallbacks);
|
||||
}
|
||||
if (configuredQueryMapper != null) {
|
||||
return configuredQueryMapper;
|
||||
}
|
||||
|
||||
EntityRowMapper<?> defaultEntityRowMapper = new EntityRowMapper<>( //
|
||||
context.getRequiredPersistentEntity(returnedObjectType), //
|
||||
converter //
|
||||
);
|
||||
|
||||
return new CallbackCapableRowMapper<>(defaultEntityRowMapper, publisher, entityCallbacks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,8 @@ public class PartTreeJdbcQuery extends AbstractJdbcQuery {
|
||||
* @since 2.3
|
||||
*/
|
||||
public PartTreeJdbcQuery(RelationalMappingContext context, JdbcQueryMethod queryMethod, Dialect dialect,
|
||||
JdbcConverter converter, NamedParameterJdbcOperations operations, org.springframework.data.jdbc.repository.query.RowMapperFactory rowMapperFactory) {
|
||||
JdbcConverter converter, NamedParameterJdbcOperations operations,
|
||||
org.springframework.data.jdbc.repository.query.RowMapperFactory rowMapperFactory) {
|
||||
|
||||
super(queryMethod, operations);
|
||||
|
||||
@@ -160,13 +161,13 @@ public class PartTreeJdbcQuery extends AbstractJdbcQuery {
|
||||
JdbcQueryExecution<?> queryExecution = getJdbcQueryExecution(extractor, rowMapper);
|
||||
|
||||
if (getQueryMethod().isSliceQuery()) {
|
||||
//noinspection unchecked
|
||||
// noinspection unchecked
|
||||
return new SliceQueryExecution<>((JdbcQueryExecution<Collection<Object>>) queryExecution, accessor.getPageable());
|
||||
}
|
||||
|
||||
if (getQueryMethod().isPageQuery()) {
|
||||
|
||||
//noinspection unchecked
|
||||
// noinspection unchecked
|
||||
return new PageQueryExecution<>((JdbcQueryExecution<Collection<Object>>) queryExecution, accessor.getPageable(),
|
||||
() -> {
|
||||
|
||||
@@ -291,7 +292,8 @@ public class PartTreeJdbcQuery extends AbstractJdbcQuery {
|
||||
private final Lazy<RowMapper<?>> rowMapper;
|
||||
private final Function<ResultProcessor, RowMapper<?>> rowMapperFunction;
|
||||
|
||||
public CachedRowMapperFactory(PartTree tree, org.springframework.data.jdbc.repository.query.RowMapperFactory rowMapperFactory, RelationalConverter converter,
|
||||
public CachedRowMapperFactory(PartTree tree,
|
||||
org.springframework.data.jdbc.repository.query.RowMapperFactory rowMapperFactory, RelationalConverter converter,
|
||||
ResultProcessor defaultResultProcessor) {
|
||||
|
||||
this.rowMapperFunction = processor -> {
|
||||
@@ -301,8 +303,8 @@ public class PartTreeJdbcQuery extends AbstractJdbcQuery {
|
||||
}
|
||||
Converter<Object, Object> resultProcessingConverter = new ResultProcessingConverter(processor,
|
||||
converter.getMappingContext(), converter.getEntityInstantiators());
|
||||
return new org.springframework.data.jdbc.repository.query.ConvertingRowMapper(rowMapperFactory.create(processor.getReturnedType().getDomainType()),
|
||||
resultProcessingConverter);
|
||||
return new org.springframework.data.jdbc.repository.query.ConvertingRowMapper(
|
||||
rowMapperFactory.create(processor.getReturnedType().getDomainType()), resultProcessingConverter);
|
||||
};
|
||||
|
||||
this.rowMapper = Lazy.of(() -> this.rowMapperFunction.apply(defaultResultProcessor));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2020-2025 the original author or authors.
|
||||
* Copyright 2025 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.
|
||||
@@ -23,36 +23,35 @@ import org.springframework.jdbc.core.RowMapper;
|
||||
*
|
||||
* @author Jens Schauder
|
||||
* @author Mikhail Polivakha
|
||||
*
|
||||
* @since 2.3
|
||||
* @since 4.0
|
||||
*/
|
||||
public interface RowMapperFactory {
|
||||
|
||||
/**
|
||||
* Obtain a {@link RowMapper} based on the expected return type passed in as an argument.
|
||||
*
|
||||
* @param result must not be {@code null}.
|
||||
* @return a {@code RowMapper} producing instances of {@code result}.
|
||||
*/
|
||||
RowMapper<Object> create(Class<?> result);
|
||||
/**
|
||||
* Obtain a {@link RowMapper} based on the expected return type passed in as an argument.
|
||||
*
|
||||
* @param result must not be {@code null}.
|
||||
* @return a {@code RowMapper} producing instances of {@code result}.
|
||||
*/
|
||||
RowMapper<Object> create(Class<?> result);
|
||||
|
||||
/**
|
||||
* Obtain a {@link RowMapper} from some other source, typically a {@link org.springframework.beans.factory.BeanFactory}.
|
||||
*
|
||||
* @param reference must not be {@code null}.
|
||||
* @since 3.4
|
||||
*/
|
||||
default RowMapper<Object> getRowMapper(String reference) {
|
||||
throw new UnsupportedOperationException("getRowMapper by reference is not supported");
|
||||
}
|
||||
/**
|
||||
* Obtain a {@link RowMapper} from some other source, typically a
|
||||
* {@link org.springframework.beans.factory.BeanFactory}.
|
||||
*
|
||||
* @param reference must not be {@code null}.
|
||||
*/
|
||||
default RowMapper<Object> getRowMapper(String reference) {
|
||||
throw new UnsupportedOperationException("getRowMapper by reference is not supported");
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtain a {@code ResultSetExtractor} from some other source, typically a {@link org.springframework.beans.factory.BeanFactory}.
|
||||
*
|
||||
* @param reference must not be {@code null}.
|
||||
* @since 3.4
|
||||
*/
|
||||
default ResultSetExtractor<Object> getResultSetExtractor(String reference) {
|
||||
throw new UnsupportedOperationException("getResultSetExtractor by reference is not supported");
|
||||
}
|
||||
/**
|
||||
* Obtain a {@code ResultSetExtractor} from some other source, typically a
|
||||
* {@link org.springframework.beans.factory.BeanFactory}.
|
||||
*
|
||||
* @param reference must not be {@code null}.
|
||||
*/
|
||||
default ResultSetExtractor<Object> getResultSetExtractor(String reference) {
|
||||
throw new UnsupportedOperationException("getResultSetExtractor by reference is not supported");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,8 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery {
|
||||
* @since 3.4
|
||||
*/
|
||||
public StringBasedJdbcQuery(JdbcQueryMethod queryMethod, NamedParameterJdbcOperations operations,
|
||||
org.springframework.data.jdbc.repository.query.RowMapperFactory rowMapperFactory, JdbcConverter converter, ValueExpressionDelegate delegate) {
|
||||
org.springframework.data.jdbc.repository.query.RowMapperFactory rowMapperFactory, JdbcConverter converter,
|
||||
ValueExpressionDelegate delegate) {
|
||||
this(queryMethod.getRequiredQuery(), queryMethod, operations, rowMapperFactory, converter, delegate);
|
||||
}
|
||||
|
||||
@@ -112,7 +113,8 @@ public class StringBasedJdbcQuery extends AbstractJdbcQuery {
|
||||
* @since 3.4
|
||||
*/
|
||||
public StringBasedJdbcQuery(String query, JdbcQueryMethod queryMethod, NamedParameterJdbcOperations operations,
|
||||
org.springframework.data.jdbc.repository.query.RowMapperFactory rowMapperFactory, JdbcConverter converter, ValueExpressionDelegate delegate) {
|
||||
org.springframework.data.jdbc.repository.query.RowMapperFactory rowMapperFactory, JdbcConverter converter,
|
||||
ValueExpressionDelegate delegate) {
|
||||
super(queryMethod, operations);
|
||||
Assert.hasText(query, "Query must not be null or empty");
|
||||
Assert.notNull(rowMapperFactory, "RowMapperFactory must not be null");
|
||||
|
||||
@@ -109,10 +109,10 @@ abstract class JdbcQueryLookupStrategy extends RelationalQueryLookupStrategy {
|
||||
QueryMappingConfiguration queryMappingConfiguration, NamedParameterJdbcOperations operations,
|
||||
ValueExpressionDelegate delegate) {
|
||||
|
||||
super(publisher, callbacks, context, converter, dialect, queryMappingConfiguration, operations,
|
||||
delegate);
|
||||
super(publisher, callbacks, context, converter, dialect, queryMappingConfiguration, operations, delegate);
|
||||
|
||||
this.rowMapperFactory = new DefaultRowMapperFactory(getMappingContext(), getConverter(), getQueryMappingConfiguration(), getCallbacks(), getPublisher());
|
||||
this.rowMapperFactory = new DefaultRowMapperFactory(getMappingContext(), getConverter(),
|
||||
getQueryMappingConfiguration(), getCallbacks(), getPublisher());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -121,7 +121,8 @@ abstract class JdbcQueryLookupStrategy extends RelationalQueryLookupStrategy {
|
||||
|
||||
JdbcQueryMethod queryMethod = getJdbcQueryMethod(method, repositoryMetadata, projectionFactory, namedQueries);
|
||||
|
||||
return new PartTreeJdbcQuery(getMappingContext(), queryMethod, getDialect(), getConverter(), getOperations(), rowMapperFactory);
|
||||
return new PartTreeJdbcQuery(getMappingContext(), queryMethod, getDialect(), getConverter(), getOperations(),
|
||||
rowMapperFactory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,10 +141,10 @@ abstract class JdbcQueryLookupStrategy extends RelationalQueryLookupStrategy {
|
||||
RelationalMappingContext context, JdbcConverter converter, Dialect dialect,
|
||||
QueryMappingConfiguration queryMappingConfiguration, NamedParameterJdbcOperations operations,
|
||||
@Nullable BeanFactory beanfactory, ValueExpressionDelegate delegate) {
|
||||
super(publisher, callbacks, context, converter, dialect, queryMappingConfiguration, operations,
|
||||
delegate);
|
||||
super(publisher, callbacks, context, converter, dialect, queryMappingConfiguration, operations, delegate);
|
||||
|
||||
this.rowMapperFactory = new BeanFactoryAwareRowMapperFactory(context, converter, queryMappingConfiguration, callbacks, publisher, beanfactory);
|
||||
this.rowMapperFactory = new BeanFactoryAwareRowMapperFactory(context, converter, queryMappingConfiguration,
|
||||
callbacks, publisher, beanfactory);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -192,11 +193,10 @@ abstract class JdbcQueryLookupStrategy extends RelationalQueryLookupStrategy {
|
||||
CreateIfNotFoundQueryLookupStrategy(ApplicationEventPublisher publisher, @Nullable EntityCallbacks callbacks,
|
||||
RelationalMappingContext context, JdbcConverter converter, Dialect dialect,
|
||||
QueryMappingConfiguration queryMappingConfiguration, NamedParameterJdbcOperations operations,
|
||||
CreateQueryLookupStrategy createStrategy,
|
||||
DeclaredQueryLookupStrategy lookupStrategy, ValueExpressionDelegate delegate) {
|
||||
CreateQueryLookupStrategy createStrategy, DeclaredQueryLookupStrategy lookupStrategy,
|
||||
ValueExpressionDelegate delegate) {
|
||||
|
||||
super(publisher, callbacks, context, converter, dialect, queryMappingConfiguration, operations,
|
||||
delegate);
|
||||
super(publisher, callbacks, context, converter, dialect, queryMappingConfiguration, operations, delegate);
|
||||
|
||||
Assert.notNull(createStrategy, "CreateQueryLookupStrategy must not be null");
|
||||
Assert.notNull(lookupStrategy, "DeclaredQueryLookupStrategy must not be null");
|
||||
@@ -264,9 +264,9 @@ abstract class JdbcQueryLookupStrategy extends RelationalQueryLookupStrategy {
|
||||
return switch (keyToUse) {
|
||||
case CREATE -> createQueryLookupStrategy;
|
||||
case USE_DECLARED_QUERY -> declaredQueryLookupStrategy;
|
||||
case CREATE_IF_NOT_FOUND -> new CreateIfNotFoundQueryLookupStrategy(
|
||||
publisher, callbacks, context, converter, dialect, queryMappingConfiguration, operations,
|
||||
createQueryLookupStrategy, declaredQueryLookupStrategy, delegate);
|
||||
case CREATE_IF_NOT_FOUND ->
|
||||
new CreateIfNotFoundQueryLookupStrategy(publisher, callbacks, context, converter, dialect,
|
||||
queryMappingConfiguration, operations, createQueryLookupStrategy, declaredQueryLookupStrategy, delegate);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -278,15 +278,15 @@ abstract class JdbcQueryLookupStrategy extends RelationalQueryLookupStrategy {
|
||||
return operations;
|
||||
}
|
||||
|
||||
QueryMappingConfiguration getQueryMappingConfiguration() {
|
||||
return queryMappingConfiguration;
|
||||
}
|
||||
QueryMappingConfiguration getQueryMappingConfiguration() {
|
||||
return queryMappingConfiguration;
|
||||
}
|
||||
|
||||
EntityCallbacks getCallbacks() {
|
||||
return callbacks;
|
||||
}
|
||||
EntityCallbacks getCallbacks() {
|
||||
return callbacks;
|
||||
}
|
||||
|
||||
ApplicationEventPublisher getPublisher() {
|
||||
return publisher;
|
||||
}
|
||||
ApplicationEventPublisher getPublisher() {
|
||||
return publisher;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user