From 102f4b7c3570470d9cd7f0781e534288a6e58033 Mon Sep 17 00:00:00 2001 From: Henning Poettker Date: Sun, 2 Jan 2022 02:15:06 +0100 Subject: [PATCH] Use strict H2 query syntax for paging query provider Simplify tests a bit Updated to snapshot dependencies Updated test and to set the version of h2 to us boot bom. --- pom.xml | 25 ++++++ ...BatchItemWriterAutoConfigurationTests.java | 3 +- ...ursorItemReaderAutoConfigurationTests.java | 6 +- .../src/test/resources/schema-h2.sql | 79 ------------------ .../support/H2PagingQueryProvider.java | 10 ++- .../SimpleTaskAutoConfigurationTests.java | 17 ++-- .../H2TaskRepositoryIntegrationTests.java | 60 ++++++++++++++ .../dao/BaseTaskExecutionDaoTestCases.java | 2 +- .../support/H2PagingQueryProviderTests.java | 81 +++++++++++++++++++ .../src/main/resources/application.properties | 1 + .../src/test/resources/schema-h2.sql | 80 ------------------ 11 files changed, 191 insertions(+), 173 deletions(-) create mode 100644 spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/H2TaskRepositoryIntegrationTests.java create mode 100644 spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/database/support/H2PagingQueryProviderTests.java diff --git a/pom.xml b/pom.xml index 91d47814..b9324018 100755 --- a/pom.xml +++ b/pom.xml @@ -94,6 +94,30 @@ spring-cloud-stream-test-support ${spring-cloud-stream.version} + org.springframework + spring-jdbc + 5.3.15-SNAPSHOT + + + org.springframework.batch + spring-batch-core + ${spring-batch.version} + + + org.springframework.batch + spring-batch-infrastructure + ${spring-batch.version} + + + org.springframework.batch + spring-batch-integration + ${spring-batch.version} + + + org.springframework.batch + spring-batch-test + ${spring-batch.version} + @@ -110,6 +134,7 @@ + 4.3.5-SNAPSHOT 3.2.1 2.7.0 2.7.0 diff --git a/spring-cloud-starter-single-step-batch-job/src/test/java/org/springframework/cloud/task/batch/autoconfigure/jdbc/JdbcBatchItemWriterAutoConfigurationTests.java b/spring-cloud-starter-single-step-batch-job/src/test/java/org/springframework/cloud/task/batch/autoconfigure/jdbc/JdbcBatchItemWriterAutoConfigurationTests.java index ba27a532..1f103a23 100644 --- a/spring-cloud-starter-single-step-batch-job/src/test/java/org/springframework/cloud/task/batch/autoconfigure/jdbc/JdbcBatchItemWriterAutoConfigurationTests.java +++ b/spring-cloud-starter-single-step-batch-job/src/test/java/org/springframework/cloud/task/batch/autoconfigure/jdbc/JdbcBatchItemWriterAutoConfigurationTests.java @@ -150,7 +150,8 @@ public class JdbcBatchItemWriterAutoConfigurationTests { return applicationContextRunner.withPropertyValues("spring.batch.job.jobName=job", "spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5", "spring.batch.job.jdbcbatchitemwriter.name=fooWriter", - "spring.batch.job.jdbcbatchitemwriter.sql=INSERT INTO item (item_name) VALUES (:item_name)"); + "spring.batch.job.jdbcbatchitemwriter.sql=INSERT INTO item (item_name) VALUES (:item_name)", + "spring.batch.jdbc.initialize-schema=always"); } private void validateResultAndBean(ApplicationContext context) { diff --git a/spring-cloud-starter-single-step-batch-job/src/test/java/org/springframework/cloud/task/batch/autoconfigure/jdbc/JdbcCursorItemReaderAutoConfigurationTests.java b/spring-cloud-starter-single-step-batch-job/src/test/java/org/springframework/cloud/task/batch/autoconfigure/jdbc/JdbcCursorItemReaderAutoConfigurationTests.java index 76112f38..b4ea07fe 100644 --- a/spring-cloud-starter-single-step-batch-job/src/test/java/org/springframework/cloud/task/batch/autoconfigure/jdbc/JdbcCursorItemReaderAutoConfigurationTests.java +++ b/spring-cloud-starter-single-step-batch-job/src/test/java/org/springframework/cloud/task/batch/autoconfigure/jdbc/JdbcCursorItemReaderAutoConfigurationTests.java @@ -100,7 +100,8 @@ public class JdbcCursorItemReaderAutoConfigurationTests { .withPropertyValues("spring.batch.job.jobName=integrationJob", "spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5", "spring.batch.job.jdbccursoritemreader.name=fooReader", - "spring.batch.job.jdbccursoritemreader.sql=select item_name from item"); + "spring.batch.job.jdbccursoritemreader.sql=select item_name from item", + "spring.batch.jdbc.initialize-schema=always"); applicationContextRunner.run((context) -> { JobLauncher jobLauncher = context.getBean(JobLauncher.class); @@ -137,7 +138,8 @@ public class JdbcCursorItemReaderAutoConfigurationTests { .withPropertyValues("spring.batch.job.jobName=rowMapperJob", "spring.batch.job.stepName=step1", "spring.batch.job.chunkSize=5", "spring.batch.job.jdbccursoritemreader.name=fooReader", - "spring.batch.job.jdbccursoritemreader.sql=select * from item"); + "spring.batch.job.jdbccursoritemreader.sql=select * from item", + "spring.batch.jdbc.initialize-schema=always"); applicationContextRunner.run((context) -> { JobLauncher jobLauncher = context.getBean(JobLauncher.class); diff --git a/spring-cloud-starter-single-step-batch-job/src/test/resources/schema-h2.sql b/spring-cloud-starter-single-step-batch-job/src/test/resources/schema-h2.sql index 1f86054b..19c55d97 100644 --- a/spring-cloud-starter-single-step-batch-job/src/test/resources/schema-h2.sql +++ b/spring-cloud-starter-single-step-batch-job/src/test/resources/schema-h2.sql @@ -2,82 +2,3 @@ CREATE TABLE IF NOT EXISTS item ( item_name varchar(55) ); -CREATE TABLE IF NOT EXISTS BATCH_JOB_INSTANCE ( - JOB_INSTANCE_ID BIGINT IDENTITY NOT NULL PRIMARY KEY , - VERSION BIGINT , - JOB_NAME VARCHAR(100) NOT NULL, - JOB_KEY VARCHAR(32) NOT NULL, - constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY) -) ; - -CREATE TABLE IF NOT EXISTS BATCH_JOB_EXECUTION ( - JOB_EXECUTION_ID BIGINT IDENTITY NOT NULL PRIMARY KEY , - VERSION BIGINT , - JOB_INSTANCE_ID BIGINT NOT NULL, - CREATE_TIME TIMESTAMP NOT NULL, - START_TIME TIMESTAMP DEFAULT NULL , - END_TIME TIMESTAMP DEFAULT NULL , - STATUS VARCHAR(10) , - EXIT_CODE VARCHAR(2500) , - EXIT_MESSAGE VARCHAR(2500) , - LAST_UPDATED TIMESTAMP, - JOB_CONFIGURATION_LOCATION VARCHAR(2500) NULL, - constraint JOB_INST_EXEC_FK foreign key (JOB_INSTANCE_ID) - references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID) -) ; - -CREATE TABLE IF NOT EXISTS BATCH_JOB_EXECUTION_PARAMS ( - JOB_EXECUTION_ID BIGINT NOT NULL , - TYPE_CD VARCHAR(6) NOT NULL , - KEY_NAME VARCHAR(100) NOT NULL , - STRING_VAL VARCHAR(250) , - DATE_VAL TIMESTAMP DEFAULT NULL , - LONG_VAL BIGINT , - DOUBLE_VAL DOUBLE PRECISION , - IDENTIFYING CHAR(1) NOT NULL , - constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID) - references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID) -) ; - -CREATE TABLE IF NOT EXISTS BATCH_STEP_EXECUTION ( - STEP_EXECUTION_ID BIGINT IDENTITY NOT NULL PRIMARY KEY , - VERSION BIGINT NOT NULL, - STEP_NAME VARCHAR(100) NOT NULL, - JOB_EXECUTION_ID BIGINT NOT NULL, - START_TIME TIMESTAMP NOT NULL , - END_TIME TIMESTAMP DEFAULT NULL , - STATUS VARCHAR(10) , - COMMIT_COUNT BIGINT , - READ_COUNT BIGINT , - FILTER_COUNT BIGINT , - WRITE_COUNT BIGINT , - READ_SKIP_COUNT BIGINT , - WRITE_SKIP_COUNT BIGINT , - PROCESS_SKIP_COUNT BIGINT , - ROLLBACK_COUNT BIGINT , - EXIT_CODE VARCHAR(2500) , - EXIT_MESSAGE VARCHAR(2500) , - LAST_UPDATED TIMESTAMP, - constraint JOB_EXEC_STEP_FK foreign key (JOB_EXECUTION_ID) - references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID) -) ; - -CREATE TABLE IF NOT EXISTS BATCH_STEP_EXECUTION_CONTEXT ( - STEP_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY, - SHORT_CONTEXT VARCHAR(2500) NOT NULL, - SERIALIZED_CONTEXT LONGVARCHAR , - constraint STEP_EXEC_CTX_FK foreign key (STEP_EXECUTION_ID) - references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID) -) ; - -CREATE TABLE IF NOT EXISTS BATCH_JOB_EXECUTION_CONTEXT ( - JOB_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY, - SHORT_CONTEXT VARCHAR(2500) NOT NULL, - SERIALIZED_CONTEXT LONGVARCHAR , - constraint JOB_EXEC_CTX_FK foreign key (JOB_EXECUTION_ID) - references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID) -) ; - -CREATE SEQUENCE IF NOT EXISTS BATCH_STEP_EXECUTION_SEQ; -CREATE SEQUENCE IF NOT EXISTS BATCH_JOB_EXECUTION_SEQ; -CREATE SEQUENCE IF NOT EXISTS BATCH_JOB_SEQ; diff --git a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/database/support/H2PagingQueryProvider.java b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/database/support/H2PagingQueryProvider.java index 1f044f51..4428818b 100644 --- a/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/database/support/H2PagingQueryProvider.java +++ b/spring-cloud-task-core/src/main/java/org/springframework/cloud/task/repository/database/support/H2PagingQueryProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2016-2019 the original author or authors. + * Copyright 2016-2022 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. @@ -23,15 +23,17 @@ import org.springframework.data.domain.Pageable; * H2 implementation of a {@link PagingQueryProvider} using database specific features. * * @author Glenn Renfro + * @author Henning Pöttker */ public class H2PagingQueryProvider extends AbstractSqlPagingQueryProvider { @Override public String getPageQuery(Pageable pageable) { - String topClause = new StringBuilder().append("LIMIT ") - .append(pageable.getOffset()).append(" ").append(pageable.getPageSize()) + String limitClause = new StringBuilder().append("OFFSET ") + .append(pageable.getOffset()).append(" ROWS FETCH NEXT ") + .append(pageable.getPageSize()).append(" ROWS ONLY") .toString(); - return SqlPagingQueryUtils.generateTopJumpToQuery(this, topClause); + return SqlPagingQueryUtils.generateLimitJumpToQuery(this, limitClause); } } diff --git a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/SimpleTaskAutoConfigurationTests.java b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/SimpleTaskAutoConfigurationTests.java index 9680e1a4..382fbe7e 100644 --- a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/SimpleTaskAutoConfigurationTests.java +++ b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/SimpleTaskAutoConfigurationTests.java @@ -133,12 +133,6 @@ public class SimpleTaskAutoConfigurationTests { .withPropertyValues("spring.cloud.task.tablePrefix=foobarless"); verifyExceptionThrownDefaultExecutable(ApplicationContextException.class, - "Failed to start " + "bean 'taskLifecycleListener'; nested exception is " - + "org.springframework.dao.DataAccessResourceFailureException: " - + "Could not obtain sequence value; nested exception is org.h2.jdbc.JdbcSQLSyntaxErrorException: " - + "Syntax error in SQL statement \"SELECT FOOBARLESSSEQ.NEXTVAL FROM[*] DUAL\"; " - + "expected \"identifier\"; SQL statement:\n" - + "select foobarlessSEQ.nextval from dual [42001-200]", applicationContextRunner); } @@ -176,6 +170,17 @@ public class SimpleTaskAutoConfigurationTests { } + public void verifyExceptionThrownDefaultExecutable(Class classToCheck, ApplicationContextRunner applicationContextRunner) { + Executable executable = () -> { + applicationContextRunner.run((context) -> { + Throwable expectedException = context.getStartupFailure(); + assertThat(expectedException).isNotNull(); + throw expectedException; + }); + }; + assertThatExceptionOfType(classToCheck).isThrownBy(executable::execute); + } + public void verifyExceptionThrownDefaultExecutable(Class classToCheck, String message, ApplicationContextRunner applicationContextRunner) { Executable executable = () -> { diff --git a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/H2TaskRepositoryIntegrationTests.java b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/H2TaskRepositoryIntegrationTests.java new file mode 100644 index 00000000..81ac644e --- /dev/null +++ b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/H2TaskRepositoryIntegrationTests.java @@ -0,0 +1,60 @@ +/* + * Copyright 2022-2022 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.cloud.task.repository; + +import java.util.UUID; + +import javax.sql.DataSource; + +import org.h2.engine.Mode.ModeEnum; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; + +import org.springframework.boot.autoconfigure.ImportAutoConfiguration; +import org.springframework.boot.test.context.runner.ApplicationContextRunner; +import org.springframework.cloud.task.configuration.EnableTask; +import org.springframework.cloud.task.configuration.SimpleTaskAutoConfiguration; +import org.springframework.jdbc.datasource.SimpleDriverDataSource; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Henning Pöttker + */ +class H2TaskRepositoryIntegrationTests { + + @ParameterizedTest + @EnumSource(ModeEnum.class) + void testTaskRepository(ModeEnum mode) { + String connectionUrl = String.format("jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;MODE=%s", UUID.randomUUID(), mode); + ApplicationContextRunner applicationContextRunner = new ApplicationContextRunner() + .withUserConfiguration(TestConfiguration.class) + .withBean(DataSource.class, + () -> new SimpleDriverDataSource(new org.h2.Driver(), connectionUrl, "sa", "")); + + applicationContextRunner.run((context -> { + TaskExplorer taskExplorer = context.getBean(TaskExplorer.class); + assertThat(taskExplorer.getTaskExecutionCount()).isOne(); + })); + } + + @EnableTask + @ImportAutoConfiguration(SimpleTaskAutoConfiguration.class) + static class TestConfiguration { + } + +} diff --git a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/BaseTaskExecutionDaoTestCases.java b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/BaseTaskExecutionDaoTestCases.java index 3d140502..109b3d9d 100644 --- a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/BaseTaskExecutionDaoTestCases.java +++ b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/dao/BaseTaskExecutionDaoTestCases.java @@ -35,7 +35,7 @@ import static org.assertj.core.api.Assertions.fail; * * @author Gunnar Hillert */ -public class BaseTaskExecutionDaoTestCases { +public abstract class BaseTaskExecutionDaoTestCases { protected TaskExecutionDao dao; diff --git a/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/database/support/H2PagingQueryProviderTests.java b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/database/support/H2PagingQueryProviderTests.java new file mode 100644 index 00000000..68347857 --- /dev/null +++ b/spring-cloud-task-core/src/test/java/org/springframework/cloud/task/repository/database/support/H2PagingQueryProviderTests.java @@ -0,0 +1,81 @@ +/* + * Copyright 2022-2022 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.cloud.task.repository.database.support; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.sql.DataSource; + +import org.h2.engine.Mode.ModeEnum; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; + +import org.springframework.batch.item.database.Order; +import org.springframework.data.domain.PageRequest; +import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.jdbc.datasource.SimpleDriverDataSource; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.support.TransactionTemplate; + +import static org.assertj.core.api.Assertions.assertThat; + +/** + * @author Henning Pöttker + */ +class H2PagingQueryProviderTests { + + @ParameterizedTest + @EnumSource(ModeEnum.class) + void testH2PagingQueryProvider(ModeEnum mode) { + String connectionUrl = String.format("jdbc:h2:mem:%s;MODE=%s", UUID.randomUUID(), mode); + DataSource dataSource = new SimpleDriverDataSource(new org.h2.Driver(), connectionUrl, "sa", ""); + JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); + PlatformTransactionManager transactionManager = new DataSourceTransactionManager(dataSource); + TransactionTemplate transactionTemplate = new TransactionTemplate(transactionManager); + + transactionTemplate.executeWithoutResult(status -> { + jdbcTemplate.execute("CREATE TABLE TEST_TABLE (ID BIGINT NOT NULL, STRING VARCHAR(10) NOT NULL)"); + jdbcTemplate.execute("INSERT INTO TEST_TABLE (ID, STRING) VALUES (1, 'Spring')"); + jdbcTemplate.execute("INSERT INTO TEST_TABLE (ID, STRING) VALUES (2, 'Cloud')"); + jdbcTemplate.execute("INSERT INTO TEST_TABLE (ID, STRING) VALUES (3, 'Task')"); + + H2PagingQueryProvider queryProvider = new H2PagingQueryProvider(); + queryProvider.setSelectClause("STRING"); + queryProvider.setFromClause("TEST_TABLE"); + Map sortKeys = new HashMap<>(); + sortKeys.put("ID", Order.ASCENDING); + queryProvider.setSortKeys(sortKeys); + + List firstPage = jdbcTemplate.queryForList( + queryProvider.getPageQuery(PageRequest.of(0, 2)), + String.class + ); + assertThat(firstPage).containsExactly("Spring", "Cloud"); + + List secondPage = jdbcTemplate.queryForList( + queryProvider.getPageQuery(PageRequest.of(1, 2)), + String.class + ); + assertThat(secondPage).containsExactly("Task"); + }); + } + +} diff --git a/spring-cloud-task-samples/single-step-batch-job/src/main/resources/application.properties b/spring-cloud-task-samples/single-step-batch-job/src/main/resources/application.properties index ec7e797e..a421a19f 100644 --- a/spring-cloud-task-samples/single-step-batch-job/src/main/resources/application.properties +++ b/spring-cloud-task-samples/single-step-batch-job/src/main/resources/application.properties @@ -2,3 +2,4 @@ spring.application.name=Single Step Batch Job spring.batch.job.jobName=job spring.batch.job.stepName=step1 spring.batch.job.chunkSize=5 +spring.batch.jdbc.initialize-schema=always diff --git a/spring-cloud-task-samples/single-step-batch-job/src/test/resources/schema-h2.sql b/spring-cloud-task-samples/single-step-batch-job/src/test/resources/schema-h2.sql index 8b320841..fe7f50f7 100644 --- a/spring-cloud-task-samples/single-step-batch-job/src/test/resources/schema-h2.sql +++ b/spring-cloud-task-samples/single-step-batch-job/src/test/resources/schema-h2.sql @@ -14,83 +14,3 @@ INSERT INTO item_sample (item_name) VALUES ('baz'); INSERT INTO item_sample (item_name) VALUES ('boo'); INSERT INTO item_sample (item_name) VALUES ('qux'); INSERT INTO item_sample (item_name) VALUES ('Job'); - -CREATE TABLE BATCH_JOB_INSTANCE ( - JOB_INSTANCE_ID BIGINT IDENTITY NOT NULL PRIMARY KEY , - VERSION BIGINT , - JOB_NAME VARCHAR(100) NOT NULL, - JOB_KEY VARCHAR(32) NOT NULL, - constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY) -) ; - -CREATE TABLE BATCH_JOB_EXECUTION ( - JOB_EXECUTION_ID BIGINT IDENTITY NOT NULL PRIMARY KEY , - VERSION BIGINT , - JOB_INSTANCE_ID BIGINT NOT NULL, - CREATE_TIME TIMESTAMP NOT NULL, - START_TIME TIMESTAMP DEFAULT NULL , - END_TIME TIMESTAMP DEFAULT NULL , - STATUS VARCHAR(10) , - EXIT_CODE VARCHAR(2500) , - EXIT_MESSAGE VARCHAR(2500) , - LAST_UPDATED TIMESTAMP, - JOB_CONFIGURATION_LOCATION VARCHAR(2500) NULL, - constraint JOB_INST_EXEC_FK foreign key (JOB_INSTANCE_ID) - references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID) -) ; - -CREATE TABLE BATCH_JOB_EXECUTION_PARAMS ( - JOB_EXECUTION_ID BIGINT NOT NULL , - TYPE_CD VARCHAR(6) NOT NULL , - KEY_NAME VARCHAR(100) NOT NULL , - STRING_VAL VARCHAR(250) , - DATE_VAL TIMESTAMP DEFAULT NULL , - LONG_VAL BIGINT , - DOUBLE_VAL DOUBLE PRECISION , - IDENTIFYING CHAR(1) NOT NULL , - constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID) - references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID) -) ; - -CREATE TABLE BATCH_STEP_EXECUTION ( - STEP_EXECUTION_ID BIGINT IDENTITY NOT NULL PRIMARY KEY , - VERSION BIGINT NOT NULL, - STEP_NAME VARCHAR(100) NOT NULL, - JOB_EXECUTION_ID BIGINT NOT NULL, - START_TIME TIMESTAMP NOT NULL , - END_TIME TIMESTAMP DEFAULT NULL , - STATUS VARCHAR(10) , - COMMIT_COUNT BIGINT , - READ_COUNT BIGINT , - FILTER_COUNT BIGINT , - WRITE_COUNT BIGINT , - READ_SKIP_COUNT BIGINT , - WRITE_SKIP_COUNT BIGINT , - PROCESS_SKIP_COUNT BIGINT , - ROLLBACK_COUNT BIGINT , - EXIT_CODE VARCHAR(2500) , - EXIT_MESSAGE VARCHAR(2500) , - LAST_UPDATED TIMESTAMP, - constraint JOB_EXEC_STEP_FK foreign key (JOB_EXECUTION_ID) - references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID) -) ; - -CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT ( - STEP_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY, - SHORT_CONTEXT VARCHAR(2500) NOT NULL, - SERIALIZED_CONTEXT LONGVARCHAR , - constraint STEP_EXEC_CTX_FK foreign key (STEP_EXECUTION_ID) - references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID) -) ; - -CREATE TABLE BATCH_JOB_EXECUTION_CONTEXT ( - JOB_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY, - SHORT_CONTEXT VARCHAR(2500) NOT NULL, - SERIALIZED_CONTEXT LONGVARCHAR , - constraint JOB_EXEC_CTX_FK foreign key (JOB_EXECUTION_ID) - references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID) -) ; - -CREATE SEQUENCE BATCH_STEP_EXECUTION_SEQ; -CREATE SEQUENCE BATCH_JOB_EXECUTION_SEQ; -CREATE SEQUENCE BATCH_JOB_SEQ;