Introduced new JDBC dialect counterparts.
Signed-off-by: mipo256 <mikhailpolivakha@gmail.com> Commit message edited by Jens Schauder Original pull request #2036 Closes #2031
This commit is contained in:
@@ -88,12 +88,5 @@ public interface JdbcArrayColumns extends ArrayColumns {
|
||||
public boolean isSupported() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArrayTypeName(SQLType jdbcType) {
|
||||
return jdbcType.getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.data.relational.core.dialect.Db2Dialect;
|
||||
* @author Christoph Strobl
|
||||
* @since 2.3
|
||||
*/
|
||||
public class JdbcDb2Dialect extends Db2Dialect {
|
||||
public class JdbcDb2Dialect extends Db2Dialect implements JdbcDialect {
|
||||
|
||||
public static JdbcDb2Dialect INSTANCE = new JdbcDb2Dialect();
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.springframework.data.relational.core.dialect.Dialect;
|
||||
* {@link org.springframework.data.relational.core.dialect.ArrayColumns} that offer JDBC specific functionality.
|
||||
*
|
||||
* @author Jens Schauder
|
||||
* @author Mikhail Polivakha
|
||||
* @since 2.3
|
||||
*/
|
||||
public interface JdbcDialect extends Dialect {
|
||||
@@ -33,6 +34,7 @@ public interface JdbcDialect extends Dialect {
|
||||
* @return the JDBC specific array support object that describes how array-typed columns are supported by this
|
||||
* dialect.
|
||||
*/
|
||||
@Override
|
||||
JdbcArrayColumns getArraySupport();
|
||||
default JdbcArrayColumns getArraySupport() {
|
||||
return JdbcArrayColumns.Unsupported.INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.dialect;
|
||||
|
||||
import org.springframework.data.jdbc.core.convert.JdbcArrayColumns;
|
||||
import org.springframework.data.relational.core.dialect.H2Dialect;
|
||||
|
||||
/**
|
||||
* JDBC specific H2 Dialect.
|
||||
*
|
||||
* @author Mikhail Polivakha
|
||||
*/
|
||||
public class JdbcH2Dialect extends H2Dialect implements JdbcDialect {
|
||||
|
||||
public static JdbcH2Dialect INSTANCE = new JdbcH2Dialect();
|
||||
|
||||
@Override
|
||||
public JdbcArrayColumns getArraySupport() {
|
||||
return new JdbcH2ArrayColumns();
|
||||
}
|
||||
|
||||
public static class JdbcH2ArrayColumns extends H2ArrayColumns implements JdbcArrayColumns { }
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.dialect;
|
||||
|
||||
import org.springframework.data.relational.core.dialect.HsqlDbDialect;
|
||||
|
||||
/**
|
||||
* JDBC specific HsqlDB Dialect.
|
||||
*
|
||||
* @author Mikhail Polivakha
|
||||
*/
|
||||
public class JdbcHsqlDbDialect extends HsqlDbDialect implements JdbcDialect {
|
||||
|
||||
public static JdbcHsqlDbDialect INSTANCE = new JdbcHsqlDbDialect();
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.dialect;
|
||||
|
||||
import org.springframework.data.relational.core.dialect.MariaDbDialect;
|
||||
import org.springframework.data.relational.core.sql.IdentifierProcessing;
|
||||
|
||||
/**
|
||||
* JDBC specific MariaDb Dialect.
|
||||
*
|
||||
* @author Mikhail Polivakha
|
||||
*/
|
||||
public class JdbcMariaDbDialect extends MariaDbDialect implements JdbcDialect {
|
||||
|
||||
public JdbcMariaDbDialect(IdentifierProcessing identifierProcessing) {
|
||||
super(identifierProcessing);
|
||||
}
|
||||
}
|
||||
@@ -38,9 +38,12 @@ import org.springframework.lang.NonNull;
|
||||
*
|
||||
* @author Jens Schauder
|
||||
* @author Christoph Strobl
|
||||
* @author Mikhail Polivakha
|
||||
* @since 2.3
|
||||
*/
|
||||
public class JdbcMySqlDialect extends MySqlDialect {
|
||||
public class JdbcMySqlDialect extends MySqlDialect implements JdbcDialect {
|
||||
|
||||
public static JdbcMySqlDialect INSTANCE = new JdbcMySqlDialect();
|
||||
|
||||
public JdbcMySqlDialect(IdentifierProcessing identifierProcessing) {
|
||||
super(identifierProcessing);
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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.dialect;
|
||||
|
||||
import org.springframework.data.jdbc.core.convert.JdbcArrayColumns;
|
||||
import org.springframework.data.relational.core.dialect.ArrayColumns;
|
||||
import org.springframework.data.relational.core.dialect.ObjectArrayColumns;
|
||||
import org.springframework.data.relational.core.dialect.OracleDialect;
|
||||
|
||||
/**
|
||||
* JDBC specific Oracle Dialect.
|
||||
*
|
||||
* @author Mikhail Polivakha
|
||||
*/
|
||||
public class JdbcOracleDialect extends OracleDialect implements JdbcDialect {
|
||||
|
||||
public static JdbcOracleDialect INSTANCE = new JdbcOracleDialect();
|
||||
|
||||
@Override
|
||||
public JdbcArrayColumns getArraySupport() {
|
||||
return new JdbcOracleArrayColumns();
|
||||
}
|
||||
|
||||
public static class JdbcOracleArrayColumns extends ObjectArrayColumns implements JdbcArrayColumns { }
|
||||
}
|
||||
@@ -35,7 +35,7 @@ import org.springframework.data.relational.core.dialect.SqlServerDialect;
|
||||
* @author Mikhail Polivakha
|
||||
* @since 2.3
|
||||
*/
|
||||
public class JdbcSqlServerDialect extends SqlServerDialect {
|
||||
public class JdbcSqlServerDialect extends SqlServerDialect implements JdbcDialect {
|
||||
|
||||
public static JdbcSqlServerDialect INSTANCE = new JdbcSqlServerDialect();
|
||||
|
||||
|
||||
@@ -29,14 +29,15 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.core.io.support.SpringFactoriesLoader;
|
||||
import org.springframework.dao.NonTransientDataAccessException;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcDb2Dialect;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcDialect;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcH2Dialect;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcHsqlDbDialect;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcMariaDbDialect;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcMySqlDialect;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcOracleDialect;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcPostgresDialect;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcSqlServerDialect;
|
||||
import org.springframework.data.relational.core.dialect.Dialect;
|
||||
import org.springframework.data.relational.core.dialect.H2Dialect;
|
||||
import org.springframework.data.relational.core.dialect.HsqlDbDialect;
|
||||
import org.springframework.data.relational.core.dialect.MariaDbDialect;
|
||||
import org.springframework.data.relational.core.dialect.OracleDialect;
|
||||
import org.springframework.data.relational.core.sql.IdentifierProcessing;
|
||||
import org.springframework.data.util.Optionals;
|
||||
import org.springframework.jdbc.core.ConnectionCallback;
|
||||
@@ -50,6 +51,7 @@ import org.springframework.util.StringUtils;
|
||||
* available {@link JdbcDialectProvider extensions}.
|
||||
*
|
||||
* @author Jens Schauder
|
||||
* @author Mikhail Polivakha
|
||||
* @since 2.0
|
||||
* @see Dialect
|
||||
* @see SpringFactoriesLoader
|
||||
@@ -109,23 +111,23 @@ public class DialectResolver {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Dialect getDialect(Connection connection) throws SQLException {
|
||||
private static JdbcDialect getDialect(Connection connection) throws SQLException {
|
||||
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
|
||||
String name = metaData.getDatabaseProductName().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
if (name.contains("hsql")) {
|
||||
return HsqlDbDialect.INSTANCE;
|
||||
return JdbcHsqlDbDialect.INSTANCE;
|
||||
}
|
||||
if (name.contains("h2")) {
|
||||
return H2Dialect.INSTANCE;
|
||||
return JdbcH2Dialect.INSTANCE;
|
||||
}
|
||||
if (name.contains("mysql")) {
|
||||
return new JdbcMySqlDialect(getIdentifierProcessing(metaData));
|
||||
}
|
||||
if (name.contains("mariadb")) {
|
||||
return new MariaDbDialect(getIdentifierProcessing(metaData));
|
||||
return new JdbcMariaDbDialect(getIdentifierProcessing(metaData));
|
||||
}
|
||||
if (name.contains("postgresql")) {
|
||||
return JdbcPostgresDialect.INSTANCE;
|
||||
@@ -137,7 +139,7 @@ public class DialectResolver {
|
||||
return JdbcDb2Dialect.INSTANCE;
|
||||
}
|
||||
if (name.contains("oracle")) {
|
||||
return OracleDialect.INSTANCE;
|
||||
return JdbcOracleDialect.INSTANCE;
|
||||
}
|
||||
|
||||
LOG.info(String.format("Couldn't determine Dialect for \"%s\"", name));
|
||||
|
||||
@@ -22,6 +22,7 @@ import static org.mockito.Mockito.*;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcHsqlDbDialect;
|
||||
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
|
||||
import org.springframework.data.relational.core.conversion.IdValueSource;
|
||||
import org.springframework.data.relational.core.dialect.Dialect;
|
||||
@@ -58,7 +59,7 @@ class DefaultDataAccessStrategyUnitTests {
|
||||
void before() {
|
||||
|
||||
DelegatingDataAccessStrategy relationResolver = new DelegatingDataAccessStrategy();
|
||||
Dialect dialect = HsqlDbDialect.INSTANCE;
|
||||
Dialect dialect = JdbcHsqlDbDialect.INSTANCE;
|
||||
converter = new MappingJdbcConverter(context, relationResolver, new JdbcCustomConversions(),
|
||||
new DefaultJdbcTypeFactory(jdbcOperations));
|
||||
accessStrategy = new DataAccessStrategyFactory( //
|
||||
|
||||
@@ -15,10 +15,11 @@
|
||||
*/
|
||||
package org.springframework.data.jdbc.core.convert;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.Mockito.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@@ -27,12 +28,11 @@ import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.jupiter.MockitoSettings;
|
||||
import org.mockito.quality.Strictness;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcMySqlDialect;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcPostgresDialect;
|
||||
import org.springframework.data.mapping.model.SimpleTypeHolder;
|
||||
import org.springframework.data.relational.core.conversion.MutableAggregateChange;
|
||||
import org.springframework.data.relational.core.dialect.MySqlDialect;
|
||||
import org.springframework.data.relational.core.dialect.PostgresDialect;
|
||||
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
|
||||
import org.springframework.data.relational.core.mapping.Sequence;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
@@ -56,7 +56,7 @@ class IdGeneratingEntityCallbackTest {
|
||||
void setUp() {
|
||||
|
||||
relationalMappingContext = new RelationalMappingContext();
|
||||
relationalMappingContext.setSimpleTypeHolder(new SimpleTypeHolder(PostgresDialect.INSTANCE.simpleTypes(), true));
|
||||
relationalMappingContext.setSimpleTypeHolder(new SimpleTypeHolder(JdbcPostgresDialect.INSTANCE.simpleTypes(), true));
|
||||
}
|
||||
|
||||
@Test // GH-1923
|
||||
@@ -65,7 +65,7 @@ class IdGeneratingEntityCallbackTest {
|
||||
NamedParameterJdbcOperations operations = mock(NamedParameterJdbcOperations.class);
|
||||
|
||||
IdGeneratingEntityCallback subject = new IdGeneratingEntityCallback(relationalMappingContext,
|
||||
MySqlDialect.INSTANCE, operations);
|
||||
JdbcMySqlDialect.INSTANCE, operations);
|
||||
|
||||
EntityWithSequence processed = (EntityWithSequence) subject.onBeforeSave(new EntityWithSequence(),
|
||||
MutableAggregateChange.forSave(new EntityWithSequence()));
|
||||
@@ -77,7 +77,7 @@ class IdGeneratingEntityCallbackTest {
|
||||
void entityIsNotMarkedWithTargetSequence() {
|
||||
|
||||
IdGeneratingEntityCallback subject = new IdGeneratingEntityCallback(relationalMappingContext,
|
||||
MySqlDialect.INSTANCE, operations);
|
||||
JdbcMySqlDialect.INSTANCE, operations);
|
||||
|
||||
NoSequenceEntity processed = (NoSequenceEntity) subject.onBeforeSave(new NoSequenceEntity(),
|
||||
MutableAggregateChange.forSave(new NoSequenceEntity()));
|
||||
@@ -93,7 +93,7 @@ class IdGeneratingEntityCallbackTest {
|
||||
.thenReturn(generatedId);
|
||||
|
||||
IdGeneratingEntityCallback subject = new IdGeneratingEntityCallback(relationalMappingContext,
|
||||
PostgresDialect.INSTANCE, operations);
|
||||
JdbcPostgresDialect.INSTANCE, operations);
|
||||
|
||||
EntityWithSequence processed = (EntityWithSequence) subject.onBeforeSave(new EntityWithSequence(),
|
||||
MutableAggregateChange.forSave(new EntityWithSequence()));
|
||||
@@ -109,7 +109,7 @@ class IdGeneratingEntityCallbackTest {
|
||||
.thenReturn(generatedId);
|
||||
|
||||
IdGeneratingEntityCallback subject = new IdGeneratingEntityCallback(relationalMappingContext,
|
||||
PostgresDialect.INSTANCE, operations);
|
||||
JdbcPostgresDialect.INSTANCE, operations);
|
||||
|
||||
EntityWithIntSequence processed = (EntityWithIntSequence) subject.onBeforeSave(new EntityWithIntSequence(),
|
||||
MutableAggregateChange.forSave(new EntityWithIntSequence()));
|
||||
@@ -125,7 +125,7 @@ class IdGeneratingEntityCallbackTest {
|
||||
.thenReturn(generatedId);
|
||||
|
||||
IdGeneratingEntityCallback subject = new IdGeneratingEntityCallback(relationalMappingContext,
|
||||
PostgresDialect.INSTANCE, operations);
|
||||
JdbcPostgresDialect.INSTANCE, operations);
|
||||
|
||||
EntityWithUuidSequence processed = (EntityWithUuidSequence) subject.onBeforeSave(new EntityWithUuidSequence(),
|
||||
MutableAggregateChange.forSave(new EntityWithUuidSequence()));
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.jdbc.core.convert;
|
||||
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcHsqlDbDialect;
|
||||
import org.springframework.data.relational.core.dialect.AbstractDialect;
|
||||
import org.springframework.data.relational.core.dialect.Dialect;
|
||||
import org.springframework.data.relational.core.dialect.HsqlDbDialect;
|
||||
@@ -38,12 +39,12 @@ public class NonQuotingDialect extends AbstractDialect implements Dialect {
|
||||
|
||||
@Override
|
||||
public LimitClause limit() {
|
||||
return HsqlDbDialect.INSTANCE.limit();
|
||||
return JdbcHsqlDbDialect.INSTANCE.limit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public LockClause lock() {
|
||||
return HsqlDbDialect.INSTANCE.lock();
|
||||
return JdbcHsqlDbDialect.INSTANCE.lock();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,11 +15,17 @@
|
||||
*/
|
||||
package org.springframework.data.jdbc.core.convert;
|
||||
|
||||
import static java.util.Collections.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.assertj.core.api.SoftAssertions.*;
|
||||
import static org.springframework.data.relational.core.mapping.ForeignKeyNaming.*;
|
||||
import static org.springframework.data.relational.core.sql.SqlIdentifier.*;
|
||||
import static java.util.Collections.emptySet;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.assertj.core.api.Assertions.entry;
|
||||
import static org.assertj.core.api.SoftAssertions.assertSoftly;
|
||||
import static org.springframework.data.relational.core.mapping.ForeignKeyNaming.APPLY_RENAMING;
|
||||
import static org.springframework.data.relational.core.mapping.ForeignKeyNaming.IGNORE_RENAMING;
|
||||
import static org.springframework.data.relational.core.sql.SqlIdentifier.EMPTY;
|
||||
import static org.springframework.data.relational.core.sql.SqlIdentifier.quoted;
|
||||
import static org.springframework.data.relational.core.sql.SqlIdentifier.unquoted;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -33,13 +39,13 @@ import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jdbc.core.PersistentPropertyPathTestUtils;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcPostgresDialect;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcSqlServerDialect;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
|
||||
import org.springframework.data.mapping.PersistentPropertyPath;
|
||||
import org.springframework.data.relational.core.dialect.AnsiDialect;
|
||||
import org.springframework.data.relational.core.dialect.Dialect;
|
||||
import org.springframework.data.relational.core.dialect.PostgresDialect;
|
||||
import org.springframework.data.relational.core.dialect.SqlServerDialect;
|
||||
import org.springframework.data.relational.core.mapping.AggregatePath;
|
||||
import org.springframework.data.relational.core.mapping.Column;
|
||||
import org.springframework.data.relational.core.mapping.DefaultNamingStrategy;
|
||||
@@ -274,7 +280,7 @@ class SqlGeneratorUnitTests {
|
||||
@Test // GH-821
|
||||
void findAllSortedWithNullHandling_resolvesNullHandlingWhenDialectSupportsIt() {
|
||||
|
||||
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntity.class, PostgresDialect.INSTANCE);
|
||||
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntity.class, JdbcPostgresDialect.INSTANCE);
|
||||
|
||||
String sql = sqlGenerator
|
||||
.getFindAll(Sort.by(new Sort.Order(Sort.Direction.ASC, "name", Sort.NullHandling.NULLS_LAST)));
|
||||
@@ -285,7 +291,7 @@ class SqlGeneratorUnitTests {
|
||||
@Test // GH-821
|
||||
void findAllSortedWithNullHandling_ignoresNullHandlingWhenDialectDoesNotSupportIt() {
|
||||
|
||||
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntity.class, SqlServerDialect.INSTANCE);
|
||||
SqlGenerator sqlGenerator = createSqlGenerator(DummyEntity.class, JdbcSqlServerDialect.INSTANCE);
|
||||
|
||||
String sql = sqlGenerator
|
||||
.getFindAll(Sort.by(new Sort.Order(Sort.Direction.ASC, "name", Sort.NullHandling.NULLS_LAST)));
|
||||
@@ -512,7 +518,7 @@ class SqlGeneratorUnitTests {
|
||||
@Test // DATAJDBC-264
|
||||
void getInsertForEmptyColumnListPostgres() {
|
||||
|
||||
SqlGenerator sqlGenerator = createSqlGenerator(IdOnlyEntity.class, PostgresDialect.INSTANCE);
|
||||
SqlGenerator sqlGenerator = createSqlGenerator(IdOnlyEntity.class, JdbcPostgresDialect.INSTANCE);
|
||||
|
||||
String insert = sqlGenerator.getInsert(emptySet());
|
||||
|
||||
@@ -522,7 +528,7 @@ class SqlGeneratorUnitTests {
|
||||
@Test // GH-777
|
||||
void gerInsertForEmptyColumnListMsSqlServer() {
|
||||
|
||||
SqlGenerator sqlGenerator = createSqlGenerator(IdOnlyEntity.class, SqlServerDialect.INSTANCE);
|
||||
SqlGenerator sqlGenerator = createSqlGenerator(IdOnlyEntity.class, JdbcSqlServerDialect.INSTANCE);
|
||||
|
||||
String insert = sqlGenerator.getInsert(emptySet());
|
||||
|
||||
|
||||
@@ -15,9 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.jdbc.mybatis;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import org.apache.ibatis.session.Configuration;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
@@ -31,18 +29,20 @@ import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jdbc.core.convert.DataAccessStrategy;
|
||||
import org.springframework.data.jdbc.core.convert.JdbcConverter;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcHsqlDbDialect;
|
||||
import org.springframework.data.jdbc.repository.config.EnableJdbcRepositories;
|
||||
import org.springframework.data.jdbc.testing.DatabaseType;
|
||||
import org.springframework.data.jdbc.testing.EnabledOnDatabase;
|
||||
import org.springframework.data.jdbc.testing.IntegrationTest;
|
||||
import org.springframework.data.jdbc.testing.TestClass;
|
||||
import org.springframework.data.jdbc.testing.TestConfiguration;
|
||||
import org.springframework.data.relational.core.dialect.HsqlDbDialect;
|
||||
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
|
||||
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
|
||||
/**
|
||||
* Tests the integration with Mybatis.
|
||||
*
|
||||
@@ -119,7 +119,7 @@ public class MyBatisHsqlIntegrationTests {
|
||||
SqlSession sqlSession, EmbeddedDatabase db) {
|
||||
|
||||
return MyBatisDataAccessStrategy.createCombinedAccessStrategy(context, converter,
|
||||
new NamedParameterJdbcTemplate(db), sqlSession, HsqlDbDialect.INSTANCE);
|
||||
new NamedParameterJdbcTemplate(db), sqlSession, JdbcHsqlDbDialect.INSTANCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,8 +16,11 @@
|
||||
|
||||
package org.springframework.data.jdbc.repository;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
|
||||
import static org.mockito.Mockito.any;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -30,11 +33,11 @@ import org.springframework.data.jdbc.core.convert.DelegatingDataAccessStrategy;
|
||||
import org.springframework.data.jdbc.core.convert.JdbcConverter;
|
||||
import org.springframework.data.jdbc.core.convert.JdbcCustomConversions;
|
||||
import org.springframework.data.jdbc.core.convert.MappingJdbcConverter;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcHsqlDbDialect;
|
||||
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
|
||||
import org.springframework.data.jdbc.repository.query.Query;
|
||||
import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory;
|
||||
import org.springframework.data.relational.core.dialect.Dialect;
|
||||
import org.springframework.data.relational.core.dialect.HsqlDbDialect;
|
||||
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
|
||||
import org.springframework.data.relational.core.mapping.Table;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
@@ -93,7 +96,7 @@ public class DeclaredQueryRepositoryUnitTests {
|
||||
|
||||
private @NotNull <T extends CrudRepository> T repository(Class<T> repositoryInterface) {
|
||||
|
||||
Dialect dialect = HsqlDbDialect.INSTANCE;
|
||||
Dialect dialect = JdbcHsqlDbDialect.INSTANCE;
|
||||
|
||||
RelationalMappingContext context = new JdbcMappingContext();
|
||||
|
||||
|
||||
@@ -15,11 +15,16 @@
|
||||
*/
|
||||
package org.springframework.data.jdbc.repository;
|
||||
|
||||
import static java.util.Arrays.*;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.groups.Tuple.tuple;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -33,13 +38,21 @@ import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jdbc.core.convert.*;
|
||||
import org.springframework.data.jdbc.core.convert.DefaultDataAccessStrategy;
|
||||
import org.springframework.data.jdbc.core.convert.DefaultJdbcTypeFactory;
|
||||
import org.springframework.data.jdbc.core.convert.DelegatingDataAccessStrategy;
|
||||
import org.springframework.data.jdbc.core.convert.InsertStrategyFactory;
|
||||
import org.springframework.data.jdbc.core.convert.JdbcConverter;
|
||||
import org.springframework.data.jdbc.core.convert.JdbcCustomConversions;
|
||||
import org.springframework.data.jdbc.core.convert.MappingJdbcConverter;
|
||||
import org.springframework.data.jdbc.core.convert.SqlGeneratorSource;
|
||||
import org.springframework.data.jdbc.core.convert.SqlParametersFactory;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcH2Dialect;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcHsqlDbDialect;
|
||||
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
|
||||
import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory;
|
||||
import org.springframework.data.jdbc.repository.support.SimpleJdbcRepository;
|
||||
import org.springframework.data.relational.core.dialect.Dialect;
|
||||
import org.springframework.data.relational.core.dialect.H2Dialect;
|
||||
import org.springframework.data.relational.core.dialect.HsqlDbDialect;
|
||||
import org.springframework.data.relational.core.mapping.RelationalMappingContext;
|
||||
import org.springframework.data.relational.core.mapping.event.AfterConvertEvent;
|
||||
import org.springframework.data.relational.core.mapping.event.AfterDeleteEvent;
|
||||
@@ -86,7 +99,7 @@ class SimpleJdbcRepositoryEventsUnitTests {
|
||||
RelationalMappingContext context = new JdbcMappingContext();
|
||||
NamedParameterJdbcOperations operations = createIdGeneratingOperations();
|
||||
|
||||
Dialect dialect = HsqlDbDialect.INSTANCE;
|
||||
Dialect dialect = JdbcHsqlDbDialect.INSTANCE;
|
||||
DelegatingDataAccessStrategy delegatingDataAccessStrategy = new DelegatingDataAccessStrategy();
|
||||
JdbcConverter converter = new MappingJdbcConverter(context, delegatingDataAccessStrategy,
|
||||
new JdbcCustomConversions(), new DefaultJdbcTypeFactory(operations.getJdbcOperations()));
|
||||
@@ -100,7 +113,7 @@ class SimpleJdbcRepositoryEventsUnitTests {
|
||||
doReturn(true).when(dataAccessStrategy).update(any(), any());
|
||||
|
||||
JdbcRepositoryFactory factory = new JdbcRepositoryFactory(dataAccessStrategy, context, converter,
|
||||
H2Dialect.INSTANCE, publisher, operations);
|
||||
JdbcH2Dialect.INSTANCE, publisher, operations);
|
||||
|
||||
this.repository = factory.getRepository(DummyEntityRepository.class);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.jdbc.core.convert.CascadingDataAccessStrategy;
|
||||
import org.springframework.data.jdbc.core.convert.DataAccessStrategy;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcHsqlDbDialect;
|
||||
import org.springframework.data.jdbc.mybatis.MyBatisDataAccessStrategy;
|
||||
import org.springframework.data.relational.core.dialect.Dialect;
|
||||
import org.springframework.data.relational.core.dialect.HsqlDbDialect;
|
||||
@@ -70,7 +71,7 @@ public class MyBatisJdbcConfigurationIntegrationTests extends AbstractJdbcConfig
|
||||
@Override
|
||||
@Bean
|
||||
public Dialect jdbcDialect(NamedParameterJdbcOperations operations) {
|
||||
return HsqlDbDialect.INSTANCE;
|
||||
return JdbcHsqlDbDialect.INSTANCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.jdbc.core.convert.JdbcConverter;
|
||||
import org.springframework.data.jdbc.core.convert.MappingJdbcConverter;
|
||||
import org.springframework.data.jdbc.core.convert.RelationResolver;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcH2Dialect;
|
||||
import org.springframework.data.jdbc.core.mapping.AggregateReference;
|
||||
import org.springframework.data.jdbc.core.mapping.JdbcMappingContext;
|
||||
import org.springframework.data.projection.SpelAwareProxyProjectionFactory;
|
||||
@@ -669,7 +670,7 @@ public class PartTreeJdbcQueryUnitTests {
|
||||
}
|
||||
|
||||
private PartTreeJdbcQuery createQuery(JdbcQueryMethod queryMethod) {
|
||||
return new PartTreeJdbcQuery(mappingContext, queryMethod, H2Dialect.INSTANCE, converter,
|
||||
return new PartTreeJdbcQuery(mappingContext, queryMethod, JdbcH2Dialect.INSTANCE, converter,
|
||||
mock(NamedParameterJdbcOperations.class), mock(RowMapper.class));
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.data.jdbc.core.convert.JdbcConverter;
|
||||
import org.springframework.data.jdbc.core.dialect.JdbcH2Dialect;
|
||||
import org.springframework.data.jdbc.repository.QueryMappingConfiguration;
|
||||
import org.springframework.data.jdbc.repository.config.DefaultQueryMappingConfiguration;
|
||||
import org.springframework.data.jdbc.repository.query.Query;
|
||||
@@ -138,7 +139,7 @@ class JdbcQueryLookupStrategyUnitTests {
|
||||
.registerRowMapper(NumberFormat.class, numberFormatMapper);
|
||||
|
||||
QueryLookupStrategy queryLookupStrategy = JdbcQueryLookupStrategy.create(key, publisher, callbacks, mappingContext,
|
||||
converter, H2Dialect.INSTANCE, mappingConfiguration, operations, null, ValueExpressionDelegate.create());
|
||||
converter, JdbcH2Dialect.INSTANCE, mappingConfiguration, operations, null, ValueExpressionDelegate.create());
|
||||
|
||||
assertThat(queryLookupStrategy).isInstanceOf(expectedClass);
|
||||
}
|
||||
@@ -158,7 +159,7 @@ class JdbcQueryLookupStrategyUnitTests {
|
||||
QueryMappingConfiguration mappingConfiguration) {
|
||||
|
||||
QueryLookupStrategy queryLookupStrategy = JdbcQueryLookupStrategy.create(key, publisher, callbacks, mappingContext,
|
||||
converter, H2Dialect.INSTANCE, mappingConfiguration, operations, null, ValueExpressionDelegate.create());
|
||||
converter, JdbcH2Dialect.INSTANCE, mappingConfiguration, operations, null, ValueExpressionDelegate.create());
|
||||
|
||||
Method method = ReflectionUtils.findMethod(MyRepository.class, name);
|
||||
return queryLookupStrategy.resolveQuery(method, metadata, projectionFactory, namedQueries);
|
||||
|
||||
@@ -32,7 +32,10 @@ public class Db2Dialect extends AbstractDialect {
|
||||
|
||||
/**
|
||||
* Singleton instance.
|
||||
*
|
||||
* @deprecated use the {@code org.springframework.data.jdbc.core.dialect.JdbcDb2Dialect} directly.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static final Db2Dialect INSTANCE = new Db2Dialect();
|
||||
|
||||
private static final IdGeneration ID_GENERATION = new IdGeneration() {
|
||||
@@ -43,6 +46,7 @@ public class Db2Dialect extends AbstractDialect {
|
||||
|
||||
@Override
|
||||
public String createSequenceQuery(SqlIdentifier sequenceName) {
|
||||
|
||||
/*
|
||||
* This workaround (non-ANSI SQL way of querying sequence) exists for the same reasons it exists for {@link HsqlDbDialect}
|
||||
*
|
||||
|
||||
@@ -38,8 +38,13 @@ public class H2Dialect extends AbstractDialect {
|
||||
|
||||
/**
|
||||
* Singleton instance.
|
||||
*
|
||||
* @deprecated use either the {@code org.springframework.data.r2dbc.dialect.H2Dialect} or
|
||||
* {@code org.springframework.data.jdbc.core.dialect.JdbcH2Dialect}.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static final H2Dialect INSTANCE = new H2Dialect();
|
||||
|
||||
private static final IdentifierProcessing IDENTIFIER_PROCESSING = IdentifierProcessing.create(Quoting.ANSI,
|
||||
LetterCasing.UPPER_CASE);
|
||||
private static final IdGeneration ID_GENERATION = IdGeneration.create(IDENTIFIER_PROCESSING);
|
||||
@@ -86,7 +91,7 @@ public class H2Dialect extends AbstractDialect {
|
||||
return ARRAY_COLUMNS;
|
||||
}
|
||||
|
||||
static class H2ArrayColumns implements ArrayColumns {
|
||||
protected static class H2ArrayColumns implements ArrayColumns {
|
||||
|
||||
@Override
|
||||
public boolean isSupported() {
|
||||
|
||||
@@ -26,6 +26,10 @@ import org.springframework.data.relational.core.sql.SqlIdentifier;
|
||||
*/
|
||||
public class HsqlDbDialect extends AbstractDialect {
|
||||
|
||||
/**
|
||||
* @deprecated use the {@code org.springframework.data.jdbc.core.dialect.JdbcHsqlDbDialect} directly.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static final HsqlDbDialect INSTANCE = new HsqlDbDialect();
|
||||
|
||||
protected HsqlDbDialect() {}
|
||||
|
||||
@@ -43,7 +43,11 @@ public class MySqlDialect extends AbstractDialect {
|
||||
|
||||
/**
|
||||
* Singleton instance.
|
||||
*
|
||||
* @deprecated use either the {@code org.springframework.data.r2dbc.dialect.MySqlDialect} or
|
||||
* {@code org.springframework.data.jdbc.core.dialect.JdbcMySqlDialect}
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static final MySqlDialect INSTANCE = new MySqlDialect();
|
||||
|
||||
private final IdentifierProcessing identifierProcessing;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.relational.core.dialect;
|
||||
|
||||
import static java.util.Arrays.*;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -35,7 +35,11 @@ public class OracleDialect extends AnsiDialect {
|
||||
|
||||
/**
|
||||
* Singleton instance.
|
||||
*
|
||||
* @deprecated use either the {@code org.springframework.data.r2dbc.dialect.OracleDialect} or
|
||||
* {@code org.springframework.data.jdbc.core.dialect.JdbcOracleDialect}.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static final OracleDialect INSTANCE = new OracleDialect();
|
||||
|
||||
private static final IdGeneration ID_GENERATION = new IdGeneration() {
|
||||
|
||||
@@ -49,13 +49,17 @@ public class PostgresDialect extends AbstractDialect {
|
||||
|
||||
/**
|
||||
* Singleton instance.
|
||||
*
|
||||
* @deprecated use either the {@code org.springframework.data.r2dbc.dialect.PostgresDialect} or
|
||||
* {@code org.springframework.data.jdbc.core.dialect.JdbcPostgresDialect}.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static final PostgresDialect INSTANCE = new PostgresDialect();
|
||||
|
||||
private static final Set<Class<?>> POSTGRES_SIMPLE_TYPES = Set.of(UUID.class, URL.class, URI.class, InetAddress.class,
|
||||
Map.class);
|
||||
|
||||
private IdentifierProcessing identifierProcessing = IdentifierProcessing.create(Quoting.ANSI,
|
||||
private static final IdentifierProcessing identifierProcessing = IdentifierProcessing.create(Quoting.ANSI,
|
||||
LetterCasing.LOWER_CASE);
|
||||
|
||||
private IdGeneration idGeneration = new IdGeneration() {
|
||||
|
||||
@@ -34,7 +34,11 @@ public class SqlServerDialect extends AbstractDialect {
|
||||
|
||||
/**
|
||||
* Singleton instance.
|
||||
*
|
||||
* @deprecated use either the {@code org.springframework.data.r2dbc.dialect.SqlServerDialect} or
|
||||
* {@code org.springframework.data.jdbc.core.dialect.JdbcSqlServerDialect}.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public static final SqlServerDialect INSTANCE = new SqlServerDialect();
|
||||
|
||||
private static final IdentifierProcessing IDENTIFIER_PROCESSING = IdentifierProcessing
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
*/
|
||||
package org.springframework.data.relational.core.dialect;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.data.relational.core.sql.From;
|
||||
import org.springframework.data.relational.core.sql.LockMode;
|
||||
import org.springframework.data.relational.core.sql.LockOptions;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
||||
/**
|
||||
* Unit tests for the {@link HsqlDbDialect}.
|
||||
*
|
||||
@@ -34,7 +34,7 @@ public class HsqlDbDialectUnitTests {
|
||||
@Test // DATAJDBC-386
|
||||
public void shouldNotSupportArrays() {
|
||||
|
||||
ArrayColumns arrayColumns = HsqlDbDialect.INSTANCE.getArraySupport();
|
||||
ArrayColumns arrayColumns = new HsqlDbDialect().getArraySupport();
|
||||
|
||||
assertThat(arrayColumns.isSupported()).isFalse();
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public class HsqlDbDialectUnitTests {
|
||||
@Test // DATAJDBC-386
|
||||
public void shouldRenderLimit() {
|
||||
|
||||
LimitClause limit = HsqlDbDialect.INSTANCE.limit();
|
||||
LimitClause limit = new HsqlDbDialect().limit();
|
||||
|
||||
assertThat(limit.getClausePosition()).isEqualTo(LimitClause.Position.AFTER_ORDER_BY);
|
||||
assertThat(limit.getLimit(10)).isEqualTo("LIMIT 10");
|
||||
@@ -51,7 +51,7 @@ public class HsqlDbDialectUnitTests {
|
||||
@Test // DATAJDBC-386
|
||||
public void shouldRenderOffset() {
|
||||
|
||||
LimitClause limit = HsqlDbDialect.INSTANCE.limit();
|
||||
LimitClause limit = new HsqlDbDialect().limit();
|
||||
|
||||
assertThat(limit.getOffset(10)).isEqualTo("OFFSET 10");
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class HsqlDbDialectUnitTests {
|
||||
@Test // DATAJDBC-386
|
||||
public void shouldRenderLimitOffset() {
|
||||
|
||||
LimitClause limit = HsqlDbDialect.INSTANCE.limit();
|
||||
LimitClause limit = new HsqlDbDialect().limit();
|
||||
|
||||
assertThat(limit.getLimitOffset(20, 10)).isEqualTo("OFFSET 10 LIMIT 20");
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class HsqlDbDialectUnitTests {
|
||||
@Test // DATAJDBC-386
|
||||
public void shouldQuoteIdentifiersUsingBackticks() {
|
||||
|
||||
String abcQuoted = HsqlDbDialect.INSTANCE.getIdentifierProcessing().quote("abc");
|
||||
String abcQuoted = new HsqlDbDialect().getIdentifierProcessing().quote("abc");
|
||||
|
||||
assertThat(abcQuoted).isEqualTo("\"abc\"");
|
||||
}
|
||||
@@ -75,7 +75,7 @@ public class HsqlDbDialectUnitTests {
|
||||
@Test // DATAJDBC-498
|
||||
public void shouldRenderLock() {
|
||||
|
||||
LockClause limit = HsqlDbDialect.INSTANCE.lock();
|
||||
LockClause limit = new HsqlDbDialect().lock();
|
||||
From from = mock(From.class);
|
||||
LockOptions lockOptions = new LockOptions(LockMode.PESSIMISTIC_WRITE, from);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ import org.springframework.data.relational.core.sql.render.SqlRenderer;
|
||||
*/
|
||||
public class MySqlDialectRenderingUnitTests {
|
||||
|
||||
private final RenderContextFactory factory = new RenderContextFactory(MySqlDialect.INSTANCE);
|
||||
private final RenderContextFactory factory = new RenderContextFactory(new MySqlDialect());
|
||||
|
||||
@BeforeEach
|
||||
public void before() {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class MySqlDialectUnitTests {
|
||||
@Test // DATAJDBC-278
|
||||
public void shouldNotSupportArrays() {
|
||||
|
||||
ArrayColumns arrayColumns = MySqlDialect.INSTANCE.getArraySupport();
|
||||
ArrayColumns arrayColumns = new MySqlDialect().getArraySupport();
|
||||
|
||||
assertThat(arrayColumns.isSupported()).isFalse();
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class MySqlDialectUnitTests {
|
||||
@Test // DATAJDBC-278
|
||||
public void shouldRenderLimit() {
|
||||
|
||||
LimitClause limit = MySqlDialect.INSTANCE.limit();
|
||||
LimitClause limit = new MySqlDialect().limit();
|
||||
|
||||
assertThat(limit.getClausePosition()).isEqualTo(LimitClause.Position.AFTER_ORDER_BY);
|
||||
assertThat(limit.getLimit(10)).isEqualTo("LIMIT 10");
|
||||
@@ -52,7 +52,7 @@ public class MySqlDialectUnitTests {
|
||||
@Test // DATAJDBC-278
|
||||
public void shouldRenderOffset() {
|
||||
|
||||
LimitClause limit = MySqlDialect.INSTANCE.limit();
|
||||
LimitClause limit = new MySqlDialect().limit();
|
||||
|
||||
assertThat(limit.getOffset(10)).isEqualTo("LIMIT 10, 18446744073709551615");
|
||||
}
|
||||
@@ -60,7 +60,7 @@ public class MySqlDialectUnitTests {
|
||||
@Test // DATAJDBC-278
|
||||
public void shouldRenderLimitOffset() {
|
||||
|
||||
LimitClause limit = MySqlDialect.INSTANCE.limit();
|
||||
LimitClause limit = new MySqlDialect().limit();
|
||||
|
||||
assertThat(limit.getLimitOffset(20, 10)).isEqualTo("LIMIT 10, 20");
|
||||
}
|
||||
@@ -68,7 +68,7 @@ public class MySqlDialectUnitTests {
|
||||
@Test // DATAJDBC-386
|
||||
public void shouldQuoteIdentifiersUsingBackticks() {
|
||||
|
||||
String abcQuoted = MySqlDialect.INSTANCE.getIdentifierProcessing().quote("abc");
|
||||
String abcQuoted = new MySqlDialect().getIdentifierProcessing().quote("abc");
|
||||
|
||||
assertThat(abcQuoted).isEqualTo("`abc`");
|
||||
}
|
||||
@@ -76,7 +76,7 @@ public class MySqlDialectUnitTests {
|
||||
@Test // DATAJDBC-498
|
||||
public void shouldRenderLock() {
|
||||
|
||||
LockClause lock = MySqlDialect.INSTANCE.lock();
|
||||
LockClause lock = new MySqlDialect().lock();
|
||||
From from = mock(From.class);
|
||||
|
||||
assertThat(lock.getLock(new LockOptions(LockMode.PESSIMISTIC_WRITE, from))).isEqualTo("FOR UPDATE");
|
||||
|
||||
Reference in New Issue
Block a user