From 382a4232e66e6402a31404e84eed6caeabc96205 Mon Sep 17 00:00:00 2001 From: Mikhail2048 Date: Thu, 24 Mar 2022 17:09:01 -0400 Subject: [PATCH] DATAJDBC-1110 --- .../jdbc/core/convert/BasicJdbcConverter.java | 5 ++-- .../convert/DefaultDataAccessStrategy.java | 6 +---- .../IdGeneratingBatchInsertStrategy.java | 4 +-- .../convert/IdGeneratingInsertStrategy.java | 4 +-- ...dbcBackReferencePropertyValueProvider.java | 13 +++------- .../convert/JdbcPropertyValueProvider.java | 10 +++---- .../jdbc/core/convert/MapEntityRowMapper.java | 9 +++---- .../data/jdbc/core/convert/SqlGenerator.java | 2 +- .../convert/SqlIdentifierParameterSource.java | 15 ++++++----- .../core/convert/SqlParametersFactory.java | 26 ++++++++++--------- .../mybatis/MyBatisDataAccessStrategy.java | 23 +++++++--------- .../config/AbstractJdbcConfiguration.java | 2 +- .../support/JdbcRepositoryFactoryBean.java | 3 +-- .../DefaultDataAccessStrategyUnitTests.java | 2 +- .../IdGeneratingBatchInsertStrategyTest.java | 7 +++-- .../IdGeneratingInsertStrategyTest.java | 2 +- .../convert/InsertStrategyFactoryTest.java | 4 +-- ...SqlIdentifierParameterSourceUnitTests.java | 13 +++++----- .../convert/SqlParametersFactoryTest.java | 4 +-- .../SimpleJdbcRepositoryEventsUnitTests.java | 2 +- ...nableJdbcRepositoriesIntegrationTests.java | 2 +- .../data/jdbc/testing/TestConfiguration.java | 2 +- .../data/r2dbc/dialect/H2Dialect.java | 2 +- .../data/r2dbc/dialect/MySqlDialect.java | 2 +- .../core/mapping/DerivedSqlIdentifier.java | 2 +- .../core/mapping/NamingStrategy.java | 2 +- .../PersistentPropertyPathExtension.java | 2 +- .../core/sql/CompositeSqlIdentifier.java | 2 +- .../core/sql/DefaultSqlIdentifier.java | 4 +-- .../relational/core/sql/SqlIdentifier.java | 16 ++++++------ .../DerivedSqlIdentifierUnitTests.java | 4 +-- .../core/sql/SqlIdentifierUnitTests.java | 4 +-- 32 files changed, 89 insertions(+), 111 deletions(-) diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/BasicJdbcConverter.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/BasicJdbcConverter.java index 0e8f665cf6..3e35055d03 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/BasicJdbcConverter.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/BasicJdbcConverter.java @@ -388,9 +388,8 @@ private ReadingContext(PersistentPropertyPathExtension rootPath, ResultSetAccess this.path = new PersistentPropertyPathExtension(getMappingContext(), this.entity); this.identifier = identifier; this.key = key; - this.propertyValueProvider = new JdbcPropertyValueProvider(identifierProcessing, path, accessor); - this.backReferencePropertyValueProvider = new JdbcBackReferencePropertyValueProvider(identifierProcessing, path, - accessor); + this.propertyValueProvider = new JdbcPropertyValueProvider(path, accessor); + this.backReferencePropertyValueProvider = new JdbcBackReferencePropertyValueProvider(path, accessor); this.accessor = accessor; } diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/DefaultDataAccessStrategy.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/DefaultDataAccessStrategy.java index 2521aef521..acf44a7bbf 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/DefaultDataAccessStrategy.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/DefaultDataAccessStrategy.java @@ -327,11 +327,7 @@ private RowMapper getMapEntityRowMapper(PersistentPropertyPathExtension path, SqlIdentifier keyColumn = path.getQualifierColumn(); Assert.notNull(keyColumn, () -> "KeyColumn must not be null for " + path); - return new MapEntityRowMapper<>(path, converter, identifier, keyColumn, getIdentifierProcessing()); - } - - private IdentifierProcessing getIdentifierProcessing() { - return sqlGeneratorSource.getDialect().getIdentifierProcessing(); + return new MapEntityRowMapper<>(path, converter, identifier, keyColumn); } @SuppressWarnings("unchecked") diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/IdGeneratingBatchInsertStrategy.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/IdGeneratingBatchInsertStrategy.java index 8ad85968fb..2b8c76f4e7 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/IdGeneratingBatchInsertStrategy.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/IdGeneratingBatchInsertStrategy.java @@ -79,7 +79,7 @@ public Object[] execute(String sql, SqlParameterSource[] sqlParameterSources) { Map keys = keyList.get(i); if (keys.size() > 1) { if (idColumn != null) { - ids[i] = keys.get(idColumn.getReference(dialect.getIdentifierProcessing())); + ids[i] = keys.get(idColumn.getReference()); } } else { ids[i] = keys.entrySet().stream().findFirst() // @@ -93,7 +93,7 @@ public Object[] execute(String sql, SqlParameterSource[] sqlParameterSources) { private String[] getKeyColumnNames() { return Optional.ofNullable(idColumn) - .map(idColumn -> new String[] { idColumn.getReference(dialect.getIdentifierProcessing()) }) + .map(idColumn -> new String[] { idColumn.getReference() }) .orElse(new String[0]); } } diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/IdGeneratingInsertStrategy.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/IdGeneratingInsertStrategy.java index 77e97163a5..de0d06ea36 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/IdGeneratingInsertStrategy.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/IdGeneratingInsertStrategy.java @@ -79,13 +79,13 @@ public Object execute(String sql, SqlParameterSource sqlParameterSource) { return null; } - return keys.get(idColumn.getReference(dialect.getIdentifierProcessing())); + return keys.get(idColumn.getReference()); } } private String[] getKeyColumnNames() { return Optional.ofNullable(idColumn) - .map(idColumn -> new String[] { idColumn.getReference(dialect.getIdentifierProcessing()) }) + .map(idColumn -> new String[] { idColumn.getReference() }) .orElse(new String[0]); } } diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/JdbcBackReferencePropertyValueProvider.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/JdbcBackReferencePropertyValueProvider.java index 2cee82111e..306c947e9e 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/JdbcBackReferencePropertyValueProvider.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/JdbcBackReferencePropertyValueProvider.java @@ -25,35 +25,30 @@ * the value in the resultset under which other entities refer back to it. * * @author Jens Schauder + * @author Mikhail Polivakha * @since 2.0 */ class JdbcBackReferencePropertyValueProvider implements PropertyValueProvider { - private final IdentifierProcessing identifierProcessing; private final PersistentPropertyPathExtension basePath; private final ResultSetAccessor resultSet; /** - * @param identifierProcessing used for converting the - * {@link org.springframework.data.relational.core.sql.SqlIdentifier} from a property to a column label * @param basePath path from the aggregate root relative to which all properties get resolved. * @param resultSet the {@link ResultSetAccessor} from which to obtain the actual values. */ - JdbcBackReferencePropertyValueProvider(IdentifierProcessing identifierProcessing, - PersistentPropertyPathExtension basePath, ResultSetAccessor resultSet) { + JdbcBackReferencePropertyValueProvider(PersistentPropertyPathExtension basePath, ResultSetAccessor resultSet) { this.resultSet = resultSet; this.basePath = basePath; - this.identifierProcessing = identifierProcessing; } @Override public T getPropertyValue(RelationalPersistentProperty property) { - return (T) resultSet - .getObject(basePath.extendBy(property).getReverseColumnNameAlias().getReference(identifierProcessing)); + return (T) resultSet.getObject(basePath.extendBy(property).getReverseColumnNameAlias().getReference()); } public JdbcBackReferencePropertyValueProvider extendBy(RelationalPersistentProperty property) { - return new JdbcBackReferencePropertyValueProvider(identifierProcessing, basePath.extendBy(property), resultSet); + return new JdbcBackReferencePropertyValueProvider(basePath.extendBy(property), resultSet); } } diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/JdbcPropertyValueProvider.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/JdbcPropertyValueProvider.java index 672469d299..d0fb38b68a 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/JdbcPropertyValueProvider.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/JdbcPropertyValueProvider.java @@ -28,22 +28,18 @@ */ class JdbcPropertyValueProvider implements PropertyValueProvider { - private final IdentifierProcessing identifierProcessing; private final PersistentPropertyPathExtension basePath; private final ResultSetAccessor resultSet; /** - * @param identifierProcessing used for converting the - * {@link org.springframework.data.relational.core.sql.SqlIdentifier} from a property to a column label * @param basePath path from the aggregate root relative to which all properties get resolved. * @param resultSet the {@link ResultSetAccessor} from which to obtain the actual values. */ - JdbcPropertyValueProvider(IdentifierProcessing identifierProcessing, PersistentPropertyPathExtension basePath, + JdbcPropertyValueProvider(PersistentPropertyPathExtension basePath, ResultSetAccessor resultSet) { this.resultSet = resultSet; this.basePath = basePath; - this.identifierProcessing = identifierProcessing; } @Override @@ -62,10 +58,10 @@ public boolean hasProperty(RelationalPersistentProperty property) { } private String getColumnName(RelationalPersistentProperty property) { - return basePath.extendBy(property).getColumnAlias().getReference(identifierProcessing); + return basePath.extendBy(property).getColumnAlias().getReference(); } public JdbcPropertyValueProvider extendBy(RelationalPersistentProperty property) { - return new JdbcPropertyValueProvider(identifierProcessing, basePath.extendBy(property), resultSet); + return new JdbcPropertyValueProvider(basePath.extendBy(property), resultSet); } } diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/MapEntityRowMapper.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/MapEntityRowMapper.java index 76f270eedc..2372e4dce7 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/MapEntityRowMapper.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/MapEntityRowMapper.java @@ -31,6 +31,7 @@ * {@link Map.Entry} is delegated to a {@link RowMapper} provided in the constructor. * * @author Jens Schauder + * @author Mikhail Polivakha */ class MapEntityRowMapper implements RowMapper> { @@ -38,22 +39,18 @@ class MapEntityRowMapper implements RowMapper> { private final JdbcConverter converter; private final Identifier identifier; private final SqlIdentifier keyColumn; - private final IdentifierProcessing identifierProcessing; - - MapEntityRowMapper(PersistentPropertyPathExtension path, JdbcConverter converter, Identifier identifier, - SqlIdentifier keyColumn, IdentifierProcessing identifierProcessing) { + MapEntityRowMapper(PersistentPropertyPathExtension path, JdbcConverter converter, Identifier identifier, SqlIdentifier keyColumn) { this.path = path; this.converter = converter; this.identifier = identifier; this.keyColumn = keyColumn; - this.identifierProcessing = identifierProcessing; } @Override public Map.Entry mapRow(ResultSet rs, int rowNum) throws SQLException { - Object key = rs.getObject(keyColumn.getReference(identifierProcessing)); + Object key = rs.getObject(keyColumn.getReference()); return new HashMap.SimpleEntry<>(key, mapEntity(rs, key)); } diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlGenerator.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlGenerator.java index c9e7c25ac3..4ebd253332 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlGenerator.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlGenerator.java @@ -705,7 +705,7 @@ private Column getVersionColumn() { } private String renderReference(SqlIdentifier identifier) { - return identifier.getReference(renderContext.getIdentifierProcessing()); + return identifier.getReference(); } private List extractOrderByFields(Sort sort) { diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlIdentifierParameterSource.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlIdentifierParameterSource.java index aaa677a8f7..4c956444cf 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlIdentifierParameterSource.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlIdentifierParameterSource.java @@ -30,16 +30,17 @@ * {@link SqlIdentifier} instead of {@link String} for names. * * @author Jens Schauder + * @author Mikhail Polivakha * @since 2.0 */ class SqlIdentifierParameterSource extends AbstractSqlParameterSource { - private final IdentifierProcessing identifierProcessing; - private final Set identifiers = new HashSet<>(); - private final Map namesToValues = new HashMap<>(); + private final Set identifiers; + private final Map namesToValues; - SqlIdentifierParameterSource(IdentifierProcessing identifierProcessing) { - this.identifierProcessing = identifierProcessing; + SqlIdentifierParameterSource() { + this.identifiers = new HashSet<>(); + this.namesToValues = new HashMap<>(); } @Override @@ -68,7 +69,7 @@ void addValue(SqlIdentifier name, Object value) { void addValue(SqlIdentifier identifier, Object value, int sqlType) { identifiers.add(identifier); - String name = identifier.getReference(identifierProcessing); + String name = identifier.getReference(); namesToValues.put(name, value); registerSqlType(name, sqlType); } @@ -77,7 +78,7 @@ void addAll(SqlIdentifierParameterSource others) { for (SqlIdentifier identifier : others.getIdentifiers()) { - String name = identifier.getReference(identifierProcessing); + String name = identifier.getReference(); addValue(identifier, others.getValue(name), others.getSqlType(name)); } } diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlParametersFactory.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlParametersFactory.java index d2a10e8cb2..80883032e3 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlParametersFactory.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/convert/SqlParametersFactory.java @@ -42,17 +42,21 @@ * * @author Jens Schauder * @author Chirag Tailor + * @author Mikhail Polivakha * @since 2.4 */ public class SqlParametersFactory { private final RelationalMappingContext context; private final JdbcConverter converter; - private final Dialect dialect; + @Deprecated public SqlParametersFactory(RelationalMappingContext context, JdbcConverter converter, Dialect dialect) { + this(context, converter); + } + + public SqlParametersFactory(RelationalMappingContext context, JdbcConverter converter) { this.context = context; this.converter = converter; - this.dialect = dialect; } /** @@ -72,7 +76,7 @@ SqlIdentifierParameterSource forInsert(T instance, Class domainType, Iden RelationalPersistentEntity persistentEntity = getRequiredPersistentEntity(domainType); SqlIdentifierParameterSource parameterSource = getParameterSource(instance, persistentEntity, "", - PersistentProperty::isIdProperty, dialect.getIdentifierProcessing()); + PersistentProperty::isIdProperty); identifier.forEach((name, value, type) -> addConvertedPropertyValue(parameterSource, name, value, type)); @@ -95,8 +99,7 @@ SqlIdentifierParameterSource forInsert(T instance, Class domainType, Iden */ SqlIdentifierParameterSource forUpdate(T instance, Class domainType) { - return getParameterSource(instance, getRequiredPersistentEntity(domainType), "", Predicates.includeAll(), - dialect.getIdentifierProcessing()); + return getParameterSource(instance, getRequiredPersistentEntity(domainType), "", Predicates.includeAll()); } /** @@ -110,7 +113,7 @@ SqlIdentifierParameterSource forUpdate(T instance, Class domainType) { */ SqlIdentifierParameterSource forQueryById(Object id, Class domainType, SqlIdentifier name) { - SqlIdentifierParameterSource parameterSource = new SqlIdentifierParameterSource(dialect.getIdentifierProcessing()); + SqlIdentifierParameterSource parameterSource = new SqlIdentifierParameterSource(); addConvertedPropertyValue( // parameterSource, // @@ -131,7 +134,7 @@ SqlIdentifierParameterSource forQueryById(Object id, Class domainType, Sq */ SqlIdentifierParameterSource forQueryByIds(Iterable ids, Class domainType) { - SqlIdentifierParameterSource parameterSource = new SqlIdentifierParameterSource(dialect.getIdentifierProcessing()); + SqlIdentifierParameterSource parameterSource = new SqlIdentifierParameterSource(); addConvertedPropertyValuesAsList(parameterSource, getRequiredPersistentEntity(domainType).getRequiredIdProperty(), ids); @@ -148,7 +151,7 @@ SqlIdentifierParameterSource forQueryByIds(Iterable ids, Class domainT */ SqlIdentifierParameterSource forQueryByIdentifier(Identifier identifier) { - SqlIdentifierParameterSource parameterSource = new SqlIdentifierParameterSource(dialect.getIdentifierProcessing()); + SqlIdentifierParameterSource parameterSource = new SqlIdentifierParameterSource(); identifier.toMap() .forEach((name, value) -> addConvertedPropertyValue(parameterSource, name, value, value.getClass())); @@ -228,9 +231,9 @@ private RelationalPersistentEntity getRequiredPersistentEntity(Class d private SqlIdentifierParameterSource getParameterSource(@Nullable S instance, RelationalPersistentEntity persistentEntity, String prefix, - Predicate skipProperty, IdentifierProcessing identifierProcessing) { + Predicate skipProperty) { - SqlIdentifierParameterSource parameters = new SqlIdentifierParameterSource(identifierProcessing); + SqlIdentifierParameterSource parameters = new SqlIdentifierParameterSource(); PersistentPropertyAccessor propertyAccessor = instance != null ? persistentEntity.getPropertyAccessor(instance) : NoValuePropertyAccessor.instance(); @@ -249,8 +252,7 @@ private SqlIdentifierParameterSource getParameterSource(@Nullable S insta Object value = propertyAccessor.getProperty(property); RelationalPersistentEntity embeddedEntity = context.getPersistentEntity(property.getType()); SqlIdentifierParameterSource additionalParameters = getParameterSource((T) value, - (RelationalPersistentEntity) embeddedEntity, prefix + property.getEmbeddedPrefix(), skipProperty, - identifierProcessing); + (RelationalPersistentEntity) embeddedEntity, prefix + property.getEmbeddedPrefix(), skipProperty); parameters.addAll(additionalParameters); } else { diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/mybatis/MyBatisDataAccessStrategy.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/mybatis/MyBatisDataAccessStrategy.java index bd66945c6a..e929347afd 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/mybatis/MyBatisDataAccessStrategy.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/mybatis/MyBatisDataAccessStrategy.java @@ -60,6 +60,7 @@ * @author Milan Milanov * @author Myeonghyeon Lee * @author Chirag Tailor + * @author Mikhail Polivakha */ public class MyBatisDataAccessStrategy implements DataAccessStrategy { @@ -67,7 +68,6 @@ public class MyBatisDataAccessStrategy implements DataAccessStrategy { private static final String VERSION_SQL_PARAMETER_NAME_OLD = "___oldOptimisticLockingVersion"; private final SqlSession sqlSession; - private final IdentifierProcessing identifierProcessing; private NamespaceStrategy namespaceStrategy = NamespaceStrategy.DEFAULT_INSTANCE; /** @@ -92,15 +92,14 @@ public static DataAccessStrategy createCombinedAccessStrategy(RelationalMappingC // 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. DelegatingDataAccessStrategy delegatingDataAccessStrategy = new DelegatingDataAccessStrategy(); - MyBatisDataAccessStrategy myBatisDataAccessStrategy = new MyBatisDataAccessStrategy(sqlSession, - dialect.getIdentifierProcessing()); + MyBatisDataAccessStrategy myBatisDataAccessStrategy = new MyBatisDataAccessStrategy(sqlSession, dialect.getIdentifierProcessing()); myBatisDataAccessStrategy.setNamespaceStrategy(namespaceStrategy); CascadingDataAccessStrategy cascadingDataAccessStrategy = new CascadingDataAccessStrategy( asList(myBatisDataAccessStrategy, delegatingDataAccessStrategy)); SqlGeneratorSource sqlGeneratorSource = new SqlGeneratorSource(context, converter, dialect); - SqlParametersFactory sqlParametersFactory = new SqlParametersFactory(context, converter, dialect); + SqlParametersFactory sqlParametersFactory = new SqlParametersFactory(context, converter); InsertStrategyFactory insertStrategyFactory = new InsertStrategyFactory(operations, new BatchJdbcOperations(operations.getJdbcOperations()), dialect); DefaultDataAccessStrategy defaultDataAccessStrategy = new DefaultDataAccessStrategy( // @@ -127,13 +126,17 @@ public static DataAccessStrategy createCombinedAccessStrategy(RelationalMappingC * to create such a {@link DataAccessStrategy}. * * @param sqlSession Must be non {@literal null}. - * @param identifierProcessing the {@link IdentifierProcessing} applied to {@link SqlIdentifier} instances in order to - * turn them into {@link String} + * + * @deprecated because identifierProcessing now will not be considered in the process of applying it to {@link SqlIdentifier}, + * use {@link MyBatisDataAccessStrategy(SqlSession)} constructor instead */ + @Deprecated public MyBatisDataAccessStrategy(SqlSession sqlSession, IdentifierProcessing identifierProcessing) { + this(sqlSession); + } + public MyBatisDataAccessStrategy(SqlSession sqlSession) { this.sqlSession = sqlSession; - this.identifierProcessing = identifierProcessing; } /** @@ -328,12 +331,6 @@ public long count(Class domainType) { return sqlSession().selectOne(statement, parameter); } - private Map convertToParameterMap(Map additionalParameters) { - - return additionalParameters.entrySet().stream() // - .collect(Collectors.toMap(e -> e.getKey().toSql(identifierProcessing), Map.Entry::getValue)); - } - private String namespace(Class domainType) { return this.namespaceStrategy.getNamespace(domainType); } diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/config/AbstractJdbcConfiguration.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/config/AbstractJdbcConfiguration.java index dde95fc1fe..215aa0d4c5 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/config/AbstractJdbcConfiguration.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/config/AbstractJdbcConfiguration.java @@ -168,7 +168,7 @@ public JdbcAggregateTemplate jdbcAggregateTemplate(ApplicationContext applicatio public DataAccessStrategy dataAccessStrategyBean(NamedParameterJdbcOperations operations, JdbcConverter jdbcConverter, JdbcMappingContext context, Dialect dialect) { return new DefaultDataAccessStrategy(new SqlGeneratorSource(context, jdbcConverter, dialect), context, - jdbcConverter, operations, new SqlParametersFactory(context, jdbcConverter, dialect), + jdbcConverter, operations, new SqlParametersFactory(context, jdbcConverter), new InsertStrategyFactory(operations, new BatchJdbcOperations(operations.getJdbcOperations()), dialect)); } diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBean.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBean.java index f6625fb58c..2f79be2dba 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBean.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/repository/support/JdbcRepositoryFactoryBean.java @@ -181,8 +181,7 @@ public void afterPropertiesSet() { SqlGeneratorSource sqlGeneratorSource = new SqlGeneratorSource(this.mappingContext, this.converter, this.dialect); - SqlParametersFactory sqlParametersFactory = new SqlParametersFactory(this.mappingContext, this.converter, - this.dialect); + SqlParametersFactory sqlParametersFactory = new SqlParametersFactory(this.mappingContext, this.converter); InsertStrategyFactory insertStrategyFactory = new InsertStrategyFactory(this.operations, new BatchJdbcOperations(this.operations.getJdbcOperations()), this.dialect); return new DefaultDataAccessStrategy(sqlGeneratorSource, this.mappingContext, this.converter, diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/DefaultDataAccessStrategyUnitTests.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/DefaultDataAccessStrategyUnitTests.java index c30e8d2bba..9aa40aba30 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/DefaultDataAccessStrategyUnitTests.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/DefaultDataAccessStrategyUnitTests.java @@ -74,7 +74,7 @@ public void before() { relationResolver.setDelegate(accessStrategy); when(sqlParametersFactory.forInsert(any(), any(), any(), any())) - .thenReturn(new SqlIdentifierParameterSource(dialect.getIdentifierProcessing())); + .thenReturn(new SqlIdentifierParameterSource()); when(insertStrategyFactory.insertStrategy(any(), any())).thenReturn(mock(InsertStrategy.class)); when(insertStrategyFactory.batchInsertStrategy(any(), any())).thenReturn(mock(BatchInsertStrategy.class)); } diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/IdGeneratingBatchInsertStrategyTest.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/IdGeneratingBatchInsertStrategyTest.java index 36c24a63f1..28e83cd0fb 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/IdGeneratingBatchInsertStrategyTest.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/IdGeneratingBatchInsertStrategyTest.java @@ -44,8 +44,7 @@ class IdGeneratingBatchInsertStrategyTest { BatchJdbcOperations batchJdbcOperations = mock(BatchJdbcOperations.class); InsertStrategy insertStrategy = mock(InsertStrategy.class); String sql = "some sql"; - SqlParameterSource[] sqlParameterSources = new SqlParameterSource[] { - new SqlIdentifierParameterSource(identifierProcessing) }; + SqlParameterSource[] sqlParameterSources = new SqlParameterSource[] {new SqlIdentifierParameterSource() }; @Test void insertsSequentially_whenIdGenerationForBatchOperationsNotSupported() { @@ -53,9 +52,9 @@ void insertsSequentially_whenIdGenerationForBatchOperationsNotSupported() { BatchInsertStrategy batchInsertStrategy = new IdGeneratingBatchInsertStrategy(insertStrategy, createDialect(identifierProcessing, true, false), batchJdbcOperations, idColumn); - SqlIdentifierParameterSource sqlParameterSource1 = new SqlIdentifierParameterSource(identifierProcessing); + SqlIdentifierParameterSource sqlParameterSource1 = new SqlIdentifierParameterSource(); sqlParameterSource1.addValue(SqlIdentifier.quoted("property1"), "value1"); - SqlIdentifierParameterSource sqlParameterSource2 = new SqlIdentifierParameterSource(identifierProcessing); + SqlIdentifierParameterSource sqlParameterSource2 = new SqlIdentifierParameterSource(); sqlParameterSource2.addValue(SqlIdentifier.quoted("property2"), "value2"); long id1 = 1L; diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/IdGeneratingInsertStrategyTest.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/IdGeneratingInsertStrategyTest.java index a7306182f5..b9c13fe6cf 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/IdGeneratingInsertStrategyTest.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/IdGeneratingInsertStrategyTest.java @@ -44,7 +44,7 @@ class IdGeneratingInsertStrategyTest { IdentifierProcessing identifierProcessing = IdentifierProcessing.ANSI; NamedParameterJdbcOperations namedParameterJdbcOperations = mock(NamedParameterJdbcOperations.class); String sql = "some sql"; - SqlParameterSource sqlParameterSource = new SqlIdentifierParameterSource(identifierProcessing); + SqlParameterSource sqlParameterSource = new SqlIdentifierParameterSource(); @Test void insertsWithKeyHolderAndKeyColumnNames_whenDriverRequiresKeyColumnNames() { diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/InsertStrategyFactoryTest.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/InsertStrategyFactoryTest.java index 35ed90174a..6cb2449096 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/InsertStrategyFactoryTest.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/InsertStrategyFactoryTest.java @@ -32,15 +32,13 @@ */ class InsertStrategyFactoryTest { - IdentifierProcessing identifierProcessing = IdentifierProcessing.ANSI; - NamedParameterJdbcOperations namedParameterJdbcOperations = mock(NamedParameterJdbcOperations.class); BatchJdbcOperations batchJdbcOperations = mock(BatchJdbcOperations.class); InsertStrategyFactory insertStrategyFactory = new InsertStrategyFactory(namedParameterJdbcOperations, batchJdbcOperations, AnsiDialect.INSTANCE); String sql = "some sql"; - SqlParameterSource sqlParameterSource = new SqlIdentifierParameterSource(identifierProcessing); + SqlParameterSource sqlParameterSource = new SqlIdentifierParameterSource(); SqlParameterSource[] sqlParameterSources = new SqlParameterSource[] { sqlParameterSource }; @Test diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlIdentifierParameterSourceUnitTests.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlIdentifierParameterSourceUnitTests.java index b7b5430a53..fed832b40e 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlIdentifierParameterSourceUnitTests.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlIdentifierParameterSourceUnitTests.java @@ -27,15 +27,14 @@ * Tests for {@link SqlIdentifierParameterSource}. * * @author Jens Schauder + * @author Mikhail Polivakha */ public class SqlIdentifierParameterSourceUnitTests { - private IdentifierProcessing identifierProcessing = IdentifierProcessing.ANSI; - @Test // DATAJDBC-386 public void empty() { - SqlIdentifierParameterSource parameters = new SqlIdentifierParameterSource(identifierProcessing); + SqlIdentifierParameterSource parameters = new SqlIdentifierParameterSource(); assertSoftly(softly -> { @@ -49,7 +48,7 @@ public void empty() { @Test // DATAJDBC-386 public void addSingleValue() { - SqlIdentifierParameterSource parameters = new SqlIdentifierParameterSource(identifierProcessing); + SqlIdentifierParameterSource parameters = new SqlIdentifierParameterSource(); parameters.addValue(SqlIdentifier.unquoted("key"), 23); @@ -68,7 +67,7 @@ public void addSingleValue() { @Test // DATAJDBC-386 public void addSingleValueWithType() { - SqlIdentifierParameterSource parameters = new SqlIdentifierParameterSource(identifierProcessing); + SqlIdentifierParameterSource parameters = new SqlIdentifierParameterSource(); parameters.addValue(SqlIdentifier.unquoted("key"), 23, 42); @@ -88,11 +87,11 @@ public void addSingleValueWithType() { @Test // DATAJDBC-386 public void addOtherDatabaseObjectIdentifierParameterSource() { - SqlIdentifierParameterSource parameters = new SqlIdentifierParameterSource(identifierProcessing); + SqlIdentifierParameterSource parameters = new SqlIdentifierParameterSource(); parameters.addValue(SqlIdentifier.unquoted("key1"), 111, 11); parameters.addValue(SqlIdentifier.unquoted("key2"), 111); - SqlIdentifierParameterSource parameters2 = new SqlIdentifierParameterSource(identifierProcessing); + SqlIdentifierParameterSource parameters2 = new SqlIdentifierParameterSource(); parameters2.addValue(SqlIdentifier.unquoted("key2"), 222, 22); parameters2.addValue(SqlIdentifier.unquoted("key3"), 222); diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlParametersFactoryTest.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlParametersFactoryTest.java index 2639ba8387..0b0166c56d 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlParametersFactoryTest.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/convert/SqlParametersFactoryTest.java @@ -53,7 +53,7 @@ class SqlParametersFactoryTest { RelationResolver relationResolver = mock(RelationResolver.class); BasicJdbcConverter converter = new BasicJdbcConverter(context, relationResolver); AnsiDialect dialect = AnsiDialect.INSTANCE; - SqlParametersFactory sqlParametersFactory = new SqlParametersFactory(context, converter, dialect); + SqlParametersFactory sqlParametersFactory = new SqlParametersFactory(context, converter); @Test // DATAJDBC-412 public void considersConfiguredWriteConverterForIdValueObjects_onRead() { @@ -217,6 +217,6 @@ private SqlParametersFactory createSqlParametersFactoryWithConverters(List co BasicJdbcConverter converter = new BasicJdbcConverter(context, relationResolver, new JdbcCustomConversions(converters), new DefaultJdbcTypeFactory(mock(JdbcOperations.class)), dialect.getIdentifierProcessing()); - return new SqlParametersFactory(context, converter, dialect); + return new SqlParametersFactory(context, converter); } } diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/SimpleJdbcRepositoryEventsUnitTests.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/SimpleJdbcRepositoryEventsUnitTests.java index 580bc988f6..b8e2ec0beb 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/SimpleJdbcRepositoryEventsUnitTests.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/SimpleJdbcRepositoryEventsUnitTests.java @@ -83,7 +83,7 @@ public void before() { JdbcConverter converter = new BasicJdbcConverter(context, delegatingDataAccessStrategy, new JdbcCustomConversions(), new DefaultJdbcTypeFactory(operations.getJdbcOperations()), dialect.getIdentifierProcessing()); SqlGeneratorSource generatorSource = new SqlGeneratorSource(context, converter, dialect); - SqlParametersFactory sqlParametersFactory = new SqlParametersFactory(context, converter, dialect); + SqlParametersFactory sqlParametersFactory = new SqlParametersFactory(context, converter); InsertStrategyFactory insertStrategyFactory = new InsertStrategyFactory(operations, new BatchJdbcOperations(operations.getJdbcOperations()), dialect); diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/config/EnableJdbcRepositoriesIntegrationTests.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/config/EnableJdbcRepositoriesIntegrationTests.java index a94b535b5c..c77a7350c7 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/config/EnableJdbcRepositoriesIntegrationTests.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/config/EnableJdbcRepositoriesIntegrationTests.java @@ -163,7 +163,7 @@ DataAccessStrategy defaultDataAccessStrategy( @Qualifier("namedParameterJdbcTemplate") NamedParameterJdbcOperations template, RelationalMappingContext context, JdbcConverter converter, Dialect dialect) { return new DefaultDataAccessStrategy(new SqlGeneratorSource(context, converter, dialect), context, converter, - template, new SqlParametersFactory(context, converter, dialect), + template, new SqlParametersFactory(context, converter), new InsertStrategyFactory(template, new BatchJdbcOperations(template.getJdbcOperations()), dialect)); } diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/TestConfiguration.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/TestConfiguration.java index 63b4a078b1..03d084322f 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/TestConfiguration.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/TestConfiguration.java @@ -96,7 +96,7 @@ DataAccessStrategy defaultDataAccessStrategy( JdbcConverter converter, Dialect dialect) { return new DefaultDataAccessStrategy(new SqlGeneratorSource(context, converter, dialect), context, converter, - template, new SqlParametersFactory(context, converter, dialect), + template, new SqlParametersFactory(context, converter), new InsertStrategyFactory(template, new BatchJdbcOperations(template.getJdbcOperations()), dialect)); } diff --git a/spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/dialect/H2Dialect.java b/spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/dialect/H2Dialect.java index 1409d4720e..0e856c54b8 100644 --- a/spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/dialect/H2Dialect.java +++ b/spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/dialect/H2Dialect.java @@ -20,7 +20,7 @@ public class H2Dialect extends PostgresDialect { @Override public String renderForGeneratedValues(SqlIdentifier identifier) { - return identifier.getReference(getIdentifierProcessing()); + return identifier.getReference(); } @Override diff --git a/spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/dialect/MySqlDialect.java b/spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/dialect/MySqlDialect.java index b4ffc259c8..4555fd989e 100644 --- a/spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/dialect/MySqlDialect.java +++ b/spring-data-r2dbc/src/main/java/org/springframework/data/r2dbc/dialect/MySqlDialect.java @@ -107,7 +107,7 @@ public Boolean convert(Byte s) { @Override public String renderForGeneratedValues(SqlIdentifier identifier) { - return identifier.getReference(getIdentifierProcessing()); + return identifier.getReference(); } /** diff --git a/spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/DerivedSqlIdentifier.java b/spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/DerivedSqlIdentifier.java index a698f85b97..36e32a0cd3 100644 --- a/spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/DerivedSqlIdentifier.java +++ b/spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/DerivedSqlIdentifier.java @@ -64,7 +64,7 @@ public String toSql(IdentifierProcessing processing) { } @Override - public String getReference(IdentifierProcessing processing) { + public String getReference() { return this.name; } diff --git a/spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/NamingStrategy.java b/spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/NamingStrategy.java index f40b65e045..886a1a6824 100644 --- a/spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/NamingStrategy.java +++ b/spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/NamingStrategy.java @@ -93,7 +93,7 @@ default String getReverseColumnName(RelationalPersistentProperty property) { Assert.notNull(property, "Property must not be null."); - return property.getOwner().getTableName().getReference(IdentifierProcessing.NONE); + return property.getOwner().getTableName().getReference(); } default String getReverseColumnName(PersistentPropertyPathExtension path) { diff --git a/spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/PersistentPropertyPathExtension.java b/spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/PersistentPropertyPathExtension.java index 690128553a..bb9c897928 100644 --- a/spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/PersistentPropertyPathExtension.java +++ b/spring-data-relational/src/main/java/org/springframework/data/relational/core/mapping/PersistentPropertyPathExtension.java @@ -445,7 +445,7 @@ private SqlIdentifier prefixWithTableAlias(SqlIdentifier columnName) { SqlIdentifier tableAlias = getTableAlias(); return tableAlias == null ? columnName - : columnName.transform(name -> tableAlias.getReference(IdentifierProcessing.NONE) + "_" + name); + : columnName.transform(name -> tableAlias.getReference() + "_" + name); } @Override diff --git a/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/CompositeSqlIdentifier.java b/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/CompositeSqlIdentifier.java index 27aba8a984..ffebc2c18b 100644 --- a/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/CompositeSqlIdentifier.java +++ b/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/CompositeSqlIdentifier.java @@ -65,7 +65,7 @@ public String toSql(IdentifierProcessing processing) { } @Override - public String getReference(IdentifierProcessing processing) { + public String getReference() { throw new UnsupportedOperationException("Composite SQL Identifiers can't be used for reference name retrieval"); } diff --git a/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/DefaultSqlIdentifier.java b/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/DefaultSqlIdentifier.java index 34dad8480f..dccce05f85 100644 --- a/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/DefaultSqlIdentifier.java +++ b/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/DefaultSqlIdentifier.java @@ -56,11 +56,11 @@ public SqlIdentifier transform(UnaryOperator transformationFunction) { @Override public String toSql(IdentifierProcessing processing) { - return quoted ? processing.quote(getReference(processing)) : getReference(processing); + return quoted ? processing.quote(getReference()) : getReference(); } @Override - public String getReference(IdentifierProcessing processing) { + public String getReference() { return name; } diff --git a/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/SqlIdentifier.java b/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/SqlIdentifier.java index 56a88cd995..c16a17d941 100644 --- a/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/SqlIdentifier.java +++ b/spring-data-relational/src/main/java/org/springframework/data/relational/core/sql/SqlIdentifier.java @@ -39,6 +39,7 @@ * * @author Jens Schauder * @author Mark Paluch + * @author Mikhail Polivakha * @since 2.0 */ public interface SqlIdentifier extends Streamable { @@ -63,11 +64,6 @@ public String toSql(IdentifierProcessing processing) { throw new UnsupportedOperationException("An empty SqlIdentifier can't be used in to create SQL snippets"); } - @Override - public String getReference(IdentifierProcessing processing) { - throw new UnsupportedOperationException("An empty SqlIdentifier can't be used in to create column names"); - } - public String toString() { return ""; } @@ -77,10 +73,14 @@ public String toString() { * Return the reference name after applying {@link IdentifierProcessing} rules. The reference name is used for * programmatic access to the object identified by this {@link SqlIdentifier}. * - * @param processing identifier processing rules. - * @return + * @param processing ignored + * + * @deprecated Since it does not differ anyhow from {@link #getReference()}, so, please, use {@link #getReference()} instead */ - String getReference(IdentifierProcessing processing); + @Deprecated + default String getReference(IdentifierProcessing processing) { + return getReference(); + } /** * Return the reference name without any further transformation. The reference name is used for programmatic access to diff --git a/spring-data-relational/src/test/java/org/springframework/data/relational/core/mapping/DerivedSqlIdentifierUnitTests.java b/spring-data-relational/src/test/java/org/springframework/data/relational/core/mapping/DerivedSqlIdentifierUnitTests.java index df63572791..0d570735be 100644 --- a/spring-data-relational/src/test/java/org/springframework/data/relational/core/mapping/DerivedSqlIdentifierUnitTests.java +++ b/spring-data-relational/src/test/java/org/springframework/data/relational/core/mapping/DerivedSqlIdentifierUnitTests.java @@ -41,7 +41,7 @@ public void quotedSimpleObjectIdentifierWithAdjustableLetterCasing() { SqlIdentifier identifier = new DerivedSqlIdentifier("someName", true); assertThat(identifier.toSql(BRACKETS_LOWER_CASE)).isEqualTo("[somename]"); - assertThat(identifier.getReference(BRACKETS_LOWER_CASE)).isEqualTo("someName"); + assertThat(identifier.getReference()).isEqualTo("someName"); } @@ -52,7 +52,7 @@ public void unquotedSimpleObjectIdentifierWithAdjustableLetterCasing() { String sql = identifier.toSql(BRACKETS_LOWER_CASE); assertThat(sql).isEqualTo("somename"); - assertThat(identifier.getReference(BRACKETS_LOWER_CASE)).isEqualTo("someName"); + assertThat(identifier.getReference()).isEqualTo("someName"); } @Test // DATAJDBC-386 diff --git a/spring-data-relational/src/test/java/org/springframework/data/relational/core/sql/SqlIdentifierUnitTests.java b/spring-data-relational/src/test/java/org/springframework/data/relational/core/sql/SqlIdentifierUnitTests.java index b81e751775..c2656b6f85 100644 --- a/spring-data-relational/src/test/java/org/springframework/data/relational/core/sql/SqlIdentifierUnitTests.java +++ b/spring-data-relational/src/test/java/org/springframework/data/relational/core/sql/SqlIdentifierUnitTests.java @@ -40,7 +40,7 @@ public void quotedSimpleObjectIdentifier() { SqlIdentifier identifier = quoted("someName"); assertThat(identifier.toSql(BRACKETS_LOWER_CASE)).isEqualTo("[someName]"); - assertThat(identifier.getReference(BRACKETS_LOWER_CASE)).isEqualTo("someName"); + assertThat(identifier.getReference()).isEqualTo("someName"); } @Test // DATAJDBC-386 @@ -50,7 +50,7 @@ public void unquotedSimpleObjectIdentifier() { String sql = identifier.toSql(BRACKETS_LOWER_CASE); assertThat(sql).isEqualTo("someName"); - assertThat(identifier.getReference(BRACKETS_LOWER_CASE)).isEqualTo("someName"); + assertThat(identifier.getReference()).isEqualTo("someName"); } @Test // DATAJDBC-386