@@ -72,6 +72,6 @@ public class BasicJdbcConverter extends MappingJdbcConverter {
|
||||
*/
|
||||
public BasicJdbcConverter(RelationalMappingContext context, RelationResolver relationResolver,
|
||||
CustomConversions conversions, JdbcTypeFactory typeFactory, IdentifierProcessing identifierProcessing) {
|
||||
super(context, relationResolver, conversions, typeFactory, identifierProcessing);
|
||||
super(context, relationResolver, conversions, typeFactory);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,7 +312,7 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy {
|
||||
return getMapEntityRowMapper(path, identifier).mapRow(rs, rowNum);
|
||||
}
|
||||
|
||||
// Add row number as key for paths that do not defile an identifier and that are contained in a collection.
|
||||
// Add row number as key for paths that do not define an identifier and that are contained in a collection.
|
||||
Identifier identifierToUse = identifier;
|
||||
if (!path.hasIdProperty() && path.isQualified()) {
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ public interface JdbcConverter extends RelationalConverter {
|
||||
@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().getType(),
|
||||
RowDocumentResultSetExtractor.toRowDocument(resultSet), identifier);
|
||||
|
||||
@@ -44,7 +44,6 @@ import org.springframework.data.relational.core.mapping.AggregatePath;
|
||||
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.core.sql.IdentifierProcessing;
|
||||
import org.springframework.data.relational.domain.RowDocument;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -77,7 +76,7 @@ public class MappingJdbcConverter extends MappingRelationalConverter implements
|
||||
/**
|
||||
* Creates a new {@link MappingJdbcConverter} given {@link MappingContext} and a {@link JdbcTypeFactory#unsupported()
|
||||
* no-op type factory} throwing {@link UnsupportedOperationException} on type creation. Use
|
||||
* {@link #MappingJdbcConverter(RelationalMappingContext, RelationResolver, CustomConversions, JdbcTypeFactory, IdentifierProcessing)}
|
||||
* {@link #MappingJdbcConverter(RelationalMappingContext, RelationResolver, CustomConversions, JdbcTypeFactory)}
|
||||
* (MappingContext, RelationResolver, JdbcTypeFactory)} to convert arrays and large objects into JDBC-specific types.
|
||||
*
|
||||
* @param context must not be {@literal null}.
|
||||
@@ -112,13 +111,6 @@ public class MappingJdbcConverter extends MappingRelationalConverter implements
|
||||
this.relationResolver = relationResolver;
|
||||
}
|
||||
|
||||
MappingJdbcConverter(RelationalMappingContext context, RelationResolver relationResolver,
|
||||
CustomConversions conversions, JdbcTypeFactory typeFactory, IdentifierProcessing identifierProcessing) {
|
||||
super(context, conversions);
|
||||
this.relationResolver = relationResolver;
|
||||
this.typeFactory = typeFactory;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Class<?> getEntityColumnType(Class<?> type) {
|
||||
|
||||
@@ -217,8 +209,8 @@ public class MappingJdbcConverter extends MappingRelationalConverter implements
|
||||
return true;
|
||||
}
|
||||
|
||||
if (AggregateReference.class.isAssignableFrom(value.getClass())) {
|
||||
return canWriteAsJdbcValue(((AggregateReference) value).getId());
|
||||
if (value instanceof AggregateReference aggregateReference) {
|
||||
return canWriteAsJdbcValue(aggregateReference.getId());
|
||||
}
|
||||
|
||||
RelationalPersistentEntity<?> persistentEntity = getMappingContext().getPersistentEntity(value.getClass());
|
||||
|
||||
@@ -60,7 +60,7 @@ class DefaultDataAccessStrategyUnitTests {
|
||||
DelegatingDataAccessStrategy relationResolver = new DelegatingDataAccessStrategy();
|
||||
Dialect dialect = HsqlDbDialect.INSTANCE;
|
||||
converter = new MappingJdbcConverter(context, relationResolver, new JdbcCustomConversions(),
|
||||
new DefaultJdbcTypeFactory(jdbcOperations), dialect.getIdentifierProcessing());
|
||||
new DefaultJdbcTypeFactory(jdbcOperations));
|
||||
accessStrategy = new DataAccessStrategyFactory( //
|
||||
new SqlGeneratorSource(context, converter, dialect), //
|
||||
converter, //
|
||||
|
||||
@@ -54,7 +54,6 @@ import org.springframework.data.relational.core.mapping.NamingStrategy;
|
||||
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.core.sql.IdentifierProcessing;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.LinkedCaseInsensitiveMap;
|
||||
@@ -1066,7 +1065,7 @@ public class EntityRowMapperUnitTests {
|
||||
.findAllByPath(identifierOfValue(ID_FOR_ENTITY_REFERENCING_LIST), any(PersistentPropertyPath.class));
|
||||
|
||||
MappingJdbcConverter converter = new MappingJdbcConverter(context, accessStrategy, new JdbcCustomConversions(),
|
||||
JdbcTypeFactory.unsupported(), IdentifierProcessing.ANSI);
|
||||
JdbcTypeFactory.unsupported());
|
||||
|
||||
return new EntityRowMapper<>( //
|
||||
(RelationalPersistentEntity<T>) context.getRequiredPersistentEntity(type), //
|
||||
|
||||
@@ -41,7 +41,6 @@ import org.springframework.data.jdbc.core.mapping.JdbcValue;
|
||||
import org.springframework.data.jdbc.support.JdbcUtil;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentEntity;
|
||||
import org.springframework.data.relational.core.mapping.RelationalPersistentProperty;
|
||||
import org.springframework.data.relational.core.sql.IdentifierProcessing;
|
||||
import org.springframework.data.util.TypeInformation;
|
||||
|
||||
/**
|
||||
@@ -59,7 +58,7 @@ public class MappingJdbcConverterUnitTests {
|
||||
throw new UnsupportedOperationException();
|
||||
}, //
|
||||
new JdbcCustomConversions(), //
|
||||
typeFactory, IdentifierProcessing.ANSI //
|
||||
typeFactory //
|
||||
);
|
||||
|
||||
@Test // DATAJDBC-104, DATAJDBC-1384
|
||||
|
||||
@@ -300,8 +300,7 @@ class SqlParametersFactoryTest {
|
||||
private SqlParametersFactory createSqlParametersFactoryWithConverters(List<?> converters) {
|
||||
|
||||
MappingJdbcConverter converter = new MappingJdbcConverter(context, relationResolver,
|
||||
new JdbcCustomConversions(converters), new DefaultJdbcTypeFactory(mock(JdbcOperations.class)),
|
||||
dialect.getIdentifierProcessing());
|
||||
new JdbcCustomConversions(converters), new DefaultJdbcTypeFactory(mock(JdbcOperations.class)));
|
||||
return new SqlParametersFactory(context, converter);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user