From 19ff9fafa6f4b871cd8a31530b2dde458bc0b27b Mon Sep 17 00:00:00 2001 From: Jens Schauder Date: Thu, 15 May 2025 14:22:06 +0200 Subject: [PATCH] Fix Sql Scripts. Original pull request #1893 --- ...sitoryIdGenerationIntegrationTests-db2.sql | 42 ++++++++++++++++--- ...toryIdGenerationIntegrationTests-mssql.sql | 8 +++- ...oryIdGenerationIntegrationTests-oracle.sql | 7 ++++ 3 files changed, 49 insertions(+), 8 deletions(-) diff --git a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIdGenerationIntegrationTests-db2.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIdGenerationIntegrationTests-db2.sql index 2b771677c..b4d471efd 100644 --- a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIdGenerationIntegrationTests-db2.sql +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIdGenerationIntegrationTests-db2.sql @@ -3,13 +3,43 @@ DROP TABLE PrimitiveIdEntity; DROP TABLE ImmutableWithManualIdentity; DROP TABLE EntityWithSeq; DROP TABLE PrimitiveIdEntityWithSeq; +DROP TABLE SimpleSeq; +DROP SEQUENCE simple_seq_seq; +DROP TABLE PersistableSeq; +DROP SEQUENCE persistable_seq_seq; +DROP TABLE PrimitiveIdSeq; +DROP SEQUENCE "primitive_seq_seq"; -CREATE TABLE ReadOnlyIdEntity (ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, NAME VARCHAR(100)); -CREATE TABLE PrimitiveIdEntity (ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 1) PRIMARY KEY, NAME VARCHAR(100)); -CREATE TABLE ImmutableWithManualIdentity (ID BIGINT NOT NULL PRIMARY KEY, NAME VARCHAR(100)); -CREATE TABLE SimpleSeq (ID BIGINT NOT NULL PRIMARY KEY, NAME VARCHAR(100)); +CREATE TABLE ReadOnlyIdEntity +( + ID BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1) PRIMARY KEY, + NAME VARCHAR(100) +); +CREATE TABLE PrimitiveIdEntity +( + ID BIGINT GENERATED BY DEFAULT AS IDENTITY (START WITH 1) PRIMARY KEY, + NAME VARCHAR(100) +); +CREATE TABLE ImmutableWithManualIdentity +( + ID BIGINT NOT NULL PRIMARY KEY, + NAME VARCHAR(100) +); +CREATE TABLE SimpleSeq +( + ID BIGINT NOT NULL PRIMARY KEY, + NAME VARCHAR(100) +); CREATE SEQUENCE simple_seq_seq START WITH 1; -CREATE TABLE PersistableSeq (ID BIGINT NOT NULL PRIMARY KEY, NAME VARCHAR(100)); +CREATE TABLE PersistableSeq +( + ID BIGINT NOT NULL PRIMARY KEY, + NAME VARCHAR(100) +); CREATE SEQUENCE persistable_seq_seq START WITH 1; -CREATE TABLE PrimitiveIdSeq (ID BIGINT NOT NULL PRIMARY KEY, NAME VARCHAR(100)); +CREATE TABLE PrimitiveIdSeq +( + ID BIGINT NOT NULL PRIMARY KEY, + NAME VARCHAR(100) +); CREATE SEQUENCE "primitive_seq_seq" START WITH 1; 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 index 9b379434c..bf06c5259 100644 --- 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 @@ -2,8 +2,12 @@ DROP TABLE IF EXISTS ReadOnlyIdEntity; DROP TABLE IF EXISTS PrimitiveIdEntity; DROP TABLE IF EXISTS ImmutableWithManualIdentity; DROP TABLE IF EXISTS EntityWithSeq; -DROP TABLE IF EXISTS PersistableEntityWithSeq; -DROP TABLE IF EXISTS PrimitiveIdEntityWithSeq; +DROP TABLE IF EXISTS SimpleSeq; +DROP SEQUENCE IF EXISTS simple_seq_seq; +DROP TABLE IF EXISTS PersistableSeq; +DROP SEQUENCE IF EXISTS persistable_seq_seq; +DROP TABLE IF EXISTS PrimitiveIdSeq; +DROP SEQUENCE IF EXISTS primitive_seq_seq; 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/JdbcRepositoryIdGenerationIntegrationTests-oracle.sql b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIdGenerationIntegrationTests-oracle.sql index 3a0416888..8974a0dc7 100644 --- a/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIdGenerationIntegrationTests-oracle.sql +++ b/spring-data-jdbc/src/test/resources/org.springframework.data.jdbc.repository/JdbcRepositoryIdGenerationIntegrationTests-oracle.sql @@ -1,6 +1,13 @@ DROP TABLE ReadOnlyIdEntity; DROP TABLE PrimitiveIdEntity; DROP TABLE ImmutableWithManualIdentity; +DROP TABLE ImmutableWithManualIdentity; +DROP TABLE SimpleSeq; +DROP SEQUENCE simple_seq_seq; +DROP TABLE PersistableSeq; +DROP SEQUENCE persistable_seq_seq; +DROP TABLE PrimitiveIdSeq; +DROP SEQUENCE "primitive_seq_seq"; CREATE TABLE ReadOnlyIdEntity ( ID NUMBER GENERATED by default on null as IDENTITY PRIMARY KEY,