diff --git a/pom.xml b/pom.xml index 8fc0950eb..2f0689ddd 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - org.springframework.data + org.springframework.data spring-data-relational-parent 1.1.0.BUILD-SNAPSHOT pom @@ -29,12 +29,14 @@ 0.1.4 2.2.8 + 7.0.0.jre8 3.4.6 1.3.2 5.1.41 42.0.0 2.2.3 - 1.7.3 + 1.9.1 + 2017 @@ -164,6 +166,24 @@ + + mssql-test + test + + test + + + + **/*IntegrationTests.java + + + **/*HsqlIntegrationTests.java + + + mssql + + + @@ -177,7 +197,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.12 + 2.22.1 org.apache.maven.plugins diff --git a/spring-data-jdbc/pom.xml b/spring-data-jdbc/pom.xml index 3c2b24faa..7a29a087d 100644 --- a/spring-data-jdbc/pom.xml +++ b/spring-data-jdbc/pom.xml @@ -158,6 +158,13 @@ test + + com.microsoft.sqlserver + mssql-jdbc + ${mssql.verion} + test + + de.schauderhaft.degraph degraph-check @@ -192,6 +199,13 @@ test + + org.testcontainers + mssqlserver + ${testcontainers.version} + test + + diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/DefaultDataAccessStrategy.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/DefaultDataAccessStrategy.java index 8f5034670..a029280c9 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/DefaultDataAccessStrategy.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/core/DefaultDataAccessStrategy.java @@ -24,6 +24,7 @@ import java.util.Map; import java.util.stream.Collectors; import java.util.stream.StreamSupport; +import org.springframework.dao.DataRetrievalFailureException; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.jdbc.support.JdbcUtil; @@ -48,6 +49,7 @@ import org.springframework.util.Assert; * * @author Jens Schauder * @author Mark Paluch + * @author Thomas Lang */ @RequiredArgsConstructor public class DefaultDataAccessStrategy implements DataAccessStrategy { @@ -319,20 +321,31 @@ public class DefaultDataAccessStrategy implements DataAccessStrategy { private Object getIdFromHolder(KeyHolder holder, RelationalPersistentEntity persistentEntity) { - try { - // MySQL just returns one value with a special name - return holder.getKey(); - } catch (InvalidDataAccessApiUsageException e) { - // Postgres returns a value for each column - Map keys = holder.getKeys(); - - if (keys == null || persistentEntity.getIdProperty() == null) { - return null; - } - - return keys.get(persistentEntity.getIdColumn()); - } - } + try { + // MySQL just returns one value with a special name + return holder.getKey(); + } catch (InvalidDataAccessApiUsageException e) { + // Postgres returns a value for each column + Map keys = holder.getKeys(); + + if (keys == null || persistentEntity.getIdProperty() == null) { + return null; + } + + return keys.get(persistentEntity.getIdColumn()); + } catch (DataRetrievalFailureException e) { + // thomas.lang@th-deg.de + // mssql causes org.springframework.dao.DataRetrievalFailureException: + // The generated key is not of a supported numeric type. Unable to cast [null] to [java.lang.Number] + // see what happens here + + Map keys = holder.getKeys(); + if (keys == null || persistentEntity.getIdProperty() == null) { + return null; + } + return null; + } + } private EntityRowMapper getEntityRowMapper(Class domainType) { return new EntityRowMapper<>(getRequiredPersistentEntity(domainType), context, converter, accessStrategy); diff --git a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/support/JdbcUtil.java b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/support/JdbcUtil.java index 12ad4b39d..e86803e1f 100644 --- a/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/support/JdbcUtil.java +++ b/spring-data-jdbc/src/main/java/org/springframework/data/jdbc/support/JdbcUtil.java @@ -32,6 +32,7 @@ import org.springframework.jdbc.support.JdbcUtils; * Contains methods dealing with the quirks of JDBC, independent of any Entity, Aggregate or Repository abstraction. * * @author Jens Schauder + * @author Thomas Lang */ @UtilityClass public class JdbcUtil { @@ -42,7 +43,7 @@ public class JdbcUtil { sqlTypeMappings.put(String.class, Types.VARCHAR); sqlTypeMappings.put(BigInteger.class, Types.BIGINT); - sqlTypeMappings.put(BigDecimal.class, Types.NUMERIC); + sqlTypeMappings.put(BigDecimal.class, Types.DECIMAL); sqlTypeMappings.put(Byte.class, Types.TINYINT); sqlTypeMappings.put(byte.class, Types.TINYINT); sqlTypeMappings.put(Short.class, Types.SMALLINT); diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/AggregateTemplateIntegrationTests.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/AggregateTemplateIntegrationTests.java index 5c9390928..1f8fb01ee 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/AggregateTemplateIntegrationTests.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/core/AggregateTemplateIntegrationTests.java @@ -34,6 +34,7 @@ import org.springframework.data.jdbc.testing.TestConfiguration; import org.springframework.data.relational.core.conversion.RelationalConverter; import org.springframework.data.relational.core.mapping.Column; import org.springframework.data.relational.core.mapping.RelationalMappingContext; +import org.springframework.test.annotation.IfProfileValue; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; @@ -46,6 +47,7 @@ import java.util.List; * Integration tests for {@link JdbcAggregateTemplate}. * * @author Jens Schauder + * @author Thomas Lang */ @ContextConfiguration @Transactional @@ -143,6 +145,7 @@ public class AggregateTemplateIntegrationTests { } @Test // DATAJDBC-112 + @IfProfileValue(name = "spring.profiles.active", values = {"mysql", "postgres", "mariadb", "default"}) // DATAJDBC-278 public void updateReferencedEntityFromNull() { legoSet.setManual(null); @@ -201,6 +204,7 @@ public class AggregateTemplateIntegrationTests { } @Test // DATAJDBC-112 + @IfProfileValue(name = "spring.profiles.active", values = {"mysql", "postgres", "mariadb", "default"}) // DATAJDBC-278 public void changeReferencedEntity() { template.save(legoSet); diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryPropertyConversionIntegrationTests.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryPropertyConversionIntegrationTests.java index 04ca4bff7..5e99a00d5 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryPropertyConversionIntegrationTests.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryPropertyConversionIntegrationTests.java @@ -43,6 +43,7 @@ import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory; import org.springframework.data.jdbc.testing.TestConfiguration; import org.springframework.data.relational.core.mapping.event.BeforeSaveEvent; import org.springframework.data.repository.CrudRepository; +import org.springframework.test.annotation.IfProfileValue; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; @@ -53,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional; * something the database driver can handle. * * @author Jens Schauder + * @author Thomas Lang */ @ContextConfiguration @Transactional @@ -88,6 +90,7 @@ public class JdbcRepositoryPropertyConversionIntegrationTests { @Autowired DummyEntityRepository repository; @Test // DATAJDBC-95 + @IfProfileValue(name = "spring.profiles.active", values = {"mysql", "postgres", "mariadb", "default"}) // DATAJDBC-278 public void saveAndLoadAnEntity() { EntityWithColumnsRequiringConversions entity = repository.save(createDummyEntity()); @@ -106,6 +109,7 @@ public class JdbcRepositoryPropertyConversionIntegrationTests { } @Test // DATAJDBC-95 + @IfProfileValue(name = "spring.profiles.active", values = {"mysql", "postgres", "mariadb", "default"}) // DATAJDBC-278 public void existsById() { EntityWithColumnsRequiringConversions entity = repository.save(createDummyEntity()); @@ -114,6 +118,7 @@ public class JdbcRepositoryPropertyConversionIntegrationTests { } @Test // DATAJDBC-95 + @IfProfileValue(name = "spring.profiles.active", values = {"mysql", "postgres", "mariadb", "default"}) // DATAJDBC-278 public void findAllById() { EntityWithColumnsRequiringConversions entity = repository.save(createDummyEntity()); @@ -122,6 +127,7 @@ public class JdbcRepositoryPropertyConversionIntegrationTests { } @Test // DATAJDBC-95 + @IfProfileValue(name = "spring.profiles.active", values = {"mysql", "postgres", "mariadb", "default"}) // DATAJDBC-278 public void deleteAll() { EntityWithColumnsRequiringConversions entity = repository.save(createDummyEntity()); @@ -132,6 +138,7 @@ public class JdbcRepositoryPropertyConversionIntegrationTests { } @Test // DATAJDBC-95 + @IfProfileValue(name = "spring.profiles.active", values = {"mysql", "postgres", "mariadb", "default"}) // DATAJDBC-278 public void deleteById() { EntityWithColumnsRequiringConversions entity = repository.save(createDummyEntity()); diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryWithCollectionsIntegrationTests.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryWithCollectionsIntegrationTests.java index 38bb8ef48..5aafde897 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryWithCollectionsIntegrationTests.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryWithCollectionsIntegrationTests.java @@ -37,6 +37,7 @@ import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory; import org.springframework.data.jdbc.testing.TestConfiguration; import org.springframework.data.repository.CrudRepository; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.test.annotation.IfProfileValue; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; @@ -46,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional; * Very simple use cases for creation and usage of JdbcRepositories. * * @author Jens Schauder + * @author Thomas Lang */ @ContextConfiguration @Transactional @@ -134,6 +136,7 @@ public class JdbcRepositoryWithCollectionsIntegrationTests { } @Test // DATAJDBC-113 + @IfProfileValue(name = "spring.profiles.active", values = {"mysql", "postgres", "mariadb", "default"}) // DATAJDBC-278 public void updateSet() { Element element1 = createElement("one"); diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryWithListsIntegrationTests.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryWithListsIntegrationTests.java index cbf30207b..752fc7c6d 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryWithListsIntegrationTests.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryWithListsIntegrationTests.java @@ -37,6 +37,7 @@ import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory; import org.springframework.data.jdbc.testing.TestConfiguration; import org.springframework.data.repository.CrudRepository; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.test.annotation.IfProfileValue; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; @@ -46,6 +47,7 @@ import org.springframework.transaction.annotation.Transactional; * Very simple use cases for creation and usage of JdbcRepositories for Entities that contain {@link List}s. * * @author Jens Schauder + * @author Thomas Lang */ @ContextConfiguration @Transactional @@ -134,6 +136,7 @@ public class JdbcRepositoryWithListsIntegrationTests { } @Test // DATAJDBC-130 + @IfProfileValue(name = "spring.profiles.active", values = {"mysql", "postgres", "mariadb", "default"}) // DATAJDBC-278 public void updateList() { Element element1 = createElement("one"); diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryWithMapsIntegrationTests.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryWithMapsIntegrationTests.java index 0a08cd1c1..70ede7515 100644 --- a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryWithMapsIntegrationTests.java +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/repository/JdbcRepositoryWithMapsIntegrationTests.java @@ -36,6 +36,7 @@ import org.springframework.data.jdbc.repository.support.JdbcRepositoryFactory; import org.springframework.data.jdbc.testing.TestConfiguration; import org.springframework.data.repository.CrudRepository; import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; +import org.springframework.test.annotation.IfProfileValue; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.rules.SpringClassRule; import org.springframework.test.context.junit4.rules.SpringMethodRule; @@ -45,6 +46,7 @@ import org.springframework.transaction.annotation.Transactional; * Very simple use cases for creation and usage of JdbcRepositories for Entities that contain {@link java.util.Map}s. * * @author Jens Schauder + * @author Thomas Lang */ @ContextConfiguration @Transactional @@ -133,6 +135,7 @@ public class JdbcRepositoryWithMapsIntegrationTests { } @Test // DATAJDBC-131 + @IfProfileValue(name = "spring.profiles.active", values = {"mysql", "postgres", "mariadb", "default"}) // DATAJDBC-278 public void updateMap() { Element element1 = createElement("one"); diff --git a/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/MsSqlDataSourceConfiguration.java b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/MsSqlDataSourceConfiguration.java new file mode 100644 index 000000000..edb644768 --- /dev/null +++ b/spring-data-jdbc/src/test/java/org/springframework/data/jdbc/testing/MsSqlDataSourceConfiguration.java @@ -0,0 +1,56 @@ +/* + * Copyright 2017-2018 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 + * + * http://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.testing; + +import com.microsoft.sqlserver.jdbc.SQLServerDataSource; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Profile; +import org.testcontainers.containers.MSSQLServerContainer; + +import javax.sql.DataSource; + + +/** + * {@link DataSource} setup for PostgreSQL. + *

+ * Configuration for a MSSQL Datasource. + * + * @author Thomas Lang + * @see + */ +@Configuration +@Profile({"mssql"}) +public class MsSqlDataSourceConfiguration extends DataSourceConfiguration { + + private static final MSSQLServerContainer mssqlserver = new MSSQLServerContainer(); + + static { + mssqlserver.start(); + } + + /* + * (non-Javadoc) + * @see org.springframework.data.jdbc.testing.DataSourceConfiguration#createDataSource() + */ + @Override + protected DataSource createDataSource() { + SQLServerDataSource sqlServerDataSource = new SQLServerDataSource(); + sqlServerDataSource.setURL(mssqlserver.getJdbcUrl()); + sqlServerDataSource.setUser(mssqlserver.getUsername()); + sqlServerDataSource.setPassword(mssqlserver.getPassword()); + return sqlServerDataSource; + } +} diff --git a/spring-data-jdbc/src/test/resources/container-license-acceptance.txt b/spring-data-jdbc/src/test/resources/container-license-acceptance.txt new file mode 100644 index 000000000..b546fb081 --- /dev/null +++ b/spring-data-jdbc/src/test/resources/container-license-acceptance.txt @@ -0,0 +1 @@ +microsoft/mssql-server-linux:2017-CU6 \ No newline at end of file diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.core/AggregateTemplateIntegrationTests-mssql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.core/AggregateTemplateIntegrationTests-mssql.sql new file mode 100644 index 000000000..12d81c9a4 --- /dev/null +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.core/AggregateTemplateIntegrationTests-mssql.sql @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS LEGO_SET; +DROP TABLE IF EXISTS MANUAL; +CREATE TABLE LEGO_SET ( id BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(30)); +CREATE TABLE MANUAL ( id BIGINT IDENTITY PRIMARY KEY, LEGO_SET BIGINT, ALTERNATIVE BIGINT, CONTENT VARCHAR(2000)); +ALTER TABLE MANUAL ADD FOREIGN KEY (LEGO_SET) REFERENCES LEGO_SET(id); + +DROP TABLE IF EXISTS ONE_TO_ONE_PARENT; +DROP TABLE IF EXISTS Child_No_Id; +CREATE TABLE ONE_TO_ONE_PARENT ( id BIGINT IDENTITY PRIMARY KEY, content VARCHAR(30)); +CREATE TABLE Child_No_Id (ONE_TO_ONE_PARENT BIGINT PRIMARY KEY, content VARCHAR(30)); + +DROP TABLE IF EXISTS LIST_PARENT; +DROP TABLE IF EXISTS element_no_id; +CREATE TABLE LIST_PARENT ( id BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100)); +CREATE TABLE element_no_id ( content VARCHAR(100), LIST_PARENT_key BIGINT, LIST_PARENT BIGINT); diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository.config/EnableJdbcRepositoriesIntegrationTests-mssql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository.config/EnableJdbcRepositoriesIntegrationTests-mssql.sql new file mode 100644 index 000000000..f9407ad2d --- /dev/null +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository.config/EnableJdbcRepositoriesIntegrationTests-mssql.sql @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS Dummy_Entity; +CREATE TABLE Dummy_Entity ( id BIGINT IDENTITY PRIMARY KEY); \ No newline at end of file diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIdGenerationIntegrationTests-mssql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIdGenerationIntegrationTests-mssql.sql new file mode 100644 index 000000000..4be191bdd --- /dev/null +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIdGenerationIntegrationTests-mssql.sql @@ -0,0 +1,5 @@ +DROP TABLE IF EXISTS ReadOnlyIdEntity; +DROP TABLE IF EXISTS PrimitiveIdEntity; + +CREATE TABLE ReadOnlyIdEntity (ID BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100)); +CREATE TABLE PrimitiveIdEntity (ID BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100)); diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIntegrationTests-mssql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIntegrationTests-mssql.sql new file mode 100644 index 000000000..937a66f1c --- /dev/null +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIntegrationTests-mssql.sql @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS dummy_entity; +CREATE TABLE dummy_entity (id_Prop BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100)); diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryManipulateDbActionsIntegrationTests-mssql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryManipulateDbActionsIntegrationTests-mssql.sql new file mode 100644 index 000000000..45ef8bd9a --- /dev/null +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryManipulateDbActionsIntegrationTests-mssql.sql @@ -0,0 +1,4 @@ +DROP TABLE IF EXISTS dummy_entity; +DROP TABLE IF EXISTS log; +CREATE TABLE dummy_entity ( id BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100), DELETED CHAR(1), log BIGINT); +CREATE TABLE log ( id BIGINT, TEXT VARCHAR(100)); diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryPropertyConversionIntegrationTests-mssql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryPropertyConversionIntegrationTests-mssql.sql new file mode 100644 index 000000000..0a420bdf9 --- /dev/null +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryPropertyConversionIntegrationTests-mssql.sql @@ -0,0 +1,2 @@ +DROP TABLE IF EXISTS ENTITY_WITH_COLUMNS_REQUIRING_CONVERSIONS; +CREATE TABLE ENTITY_WITH_COLUMNS_REQUIRING_CONVERSIONS ( id_Timestamp DATETIME PRIMARY KEY, bool bit, SOME_ENUM VARCHAR(100), big_Decimal DECIMAL(38), big_Integer DECIMAL(20), date DATETIME, local_Date_Time DATETIME, zoned_Date_Time VARCHAR(30)); diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryWithCollectionsIntegrationTests-mssql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryWithCollectionsIntegrationTests-mssql.sql new file mode 100644 index 000000000..bc0abc14c --- /dev/null +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryWithCollectionsIntegrationTests-mssql.sql @@ -0,0 +1,4 @@ +DROP TABLE IF EXISTS dummy_entity; +DROP TABLE IF EXISTS element; +CREATE TABLE dummy_entity ( id BIGINT identity PRIMARY KEY, NAME VARCHAR(100)); +CREATE TABLE element (id BIGINT identity PRIMARY KEY, content VARCHAR(100), dummy_entity BIGINT); diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryWithCollectionsNoIdIntegrationTests-mssql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryWithCollectionsNoIdIntegrationTests-mssql.sql new file mode 100644 index 000000000..3d2cd82c2 --- /dev/null +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryWithCollectionsNoIdIntegrationTests-mssql.sql @@ -0,0 +1,4 @@ +DROP TABLE IF EXISTS dummy_entity; +DROP TABLE IF EXISTS element; +CREATE TABLE dummy_entity ( id BIGINT identity PRIMARY KEY, NAME VARCHAR(100)); +CREATE TABLE element (content VARCHAR(100), dummy_entity BIGINT); diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryWithListsIntegrationTests-mssql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryWithListsIntegrationTests-mssql.sql new file mode 100644 index 000000000..a8d4104d4 --- /dev/null +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryWithListsIntegrationTests-mssql.sql @@ -0,0 +1,4 @@ +DROP TABLE IF EXISTS dummy_entity; +DROP TABLE IF EXISTS element; +CREATE TABLE dummy_entity ( id BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100)); +CREATE TABLE element (id BIGINT IDENTITY PRIMARY KEY, content VARCHAR(100), Dummy_Entity_key BIGINT,dummy_entity BIGINT); diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryWithMapsIntegrationTests-mssql.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryWithMapsIntegrationTests-mssql.sql new file mode 100644 index 000000000..01ba3be52 --- /dev/null +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryWithMapsIntegrationTests-mssql.sql @@ -0,0 +1,4 @@ +DROP TABLE IF EXISTS dummy_entity; +DROP TABLE IF EXISTS element; +CREATE TABLE dummy_entity ( id BIGINT IDENTITY PRIMARY KEY, NAME VARCHAR(100)); +CREATE TABLE element (id BIGINT IDENTITY PRIMARY KEY, content VARCHAR(100), Dummy_Entity_key VARCHAR(100),dummy_entity BIGINT);