diff --git a/pom.xml b/pom.xml
index 60e30973e0..82a4bcb33e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -88,7 +88,7 @@
2.9.0
1.7.32
2.6.1
-
1.4.200
+ 2.0.206
3.36.0.3
10.14.2.0
2.19.0
diff --git a/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-h2.sql b/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-h2.sql
index af047d8735..8c78e9a0da 100644
--- a/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-h2.sql
+++ b/spring-batch-core/src/main/resources/org/springframework/batch/core/schema-h2.sql
@@ -1,7 +1,7 @@
-- Autogenerated: do not edit this file
CREATE TABLE BATCH_JOB_INSTANCE (
- JOB_INSTANCE_ID BIGINT IDENTITY NOT NULL PRIMARY KEY ,
+ JOB_INSTANCE_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,
VERSION BIGINT ,
JOB_NAME VARCHAR(100) NOT NULL,
JOB_KEY VARCHAR(32) NOT NULL,
@@ -9,7 +9,7 @@ CREATE TABLE BATCH_JOB_INSTANCE (
) ;
CREATE TABLE BATCH_JOB_EXECUTION (
- JOB_EXECUTION_ID BIGINT IDENTITY NOT NULL PRIMARY KEY ,
+ JOB_EXECUTION_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,
VERSION BIGINT ,
JOB_INSTANCE_ID BIGINT NOT NULL,
CREATE_TIME TIMESTAMP NOT NULL,
@@ -37,7 +37,7 @@ CREATE TABLE BATCH_JOB_EXECUTION_PARAMS (
) ;
CREATE TABLE BATCH_STEP_EXECUTION (
- STEP_EXECUTION_ID BIGINT IDENTITY NOT NULL PRIMARY KEY ,
+ STEP_EXECUTION_ID BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY ,
VERSION BIGINT NOT NULL,
STEP_NAME VARCHAR(100) NOT NULL,
JOB_EXECUTION_ID BIGINT NOT NULL,
diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/H2CompatibilityModeJobRepositoryIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/H2CompatibilityModeJobRepositoryIntegrationTests.java
new file mode 100644
index 0000000000..8e9b6b9c0f
--- /dev/null
+++ b/spring-batch-core/src/test/java/org/springframework/batch/core/test/repository/H2CompatibilityModeJobRepositoryIntegrationTests.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 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.batch.core.test.repository;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import javax.sql.DataSource;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import org.springframework.batch.core.ExitStatus;
+import org.springframework.batch.core.Job;
+import org.springframework.batch.core.JobParameters;
+import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
+import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
+import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
+import org.springframework.batch.core.launch.JobLauncher;
+import org.springframework.batch.repeat.RepeatStatus;
+import org.springframework.context.annotation.AnnotationConfigApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.DefaultResourceLoader;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.datasource.SimpleDriverDataSource;
+import org.springframework.jdbc.datasource.init.DatabasePopulatorUtils;
+import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator;
+
+/**
+ * @author Henning Pƶttker
+ */
+@RunWith(Parameterized.class)
+public class H2CompatibilityModeJobRepositoryIntegrationTests {
+
+ private final String compatibilityMode;
+
+ public H2CompatibilityModeJobRepositoryIntegrationTests(String compatibilityMode) {
+ this.compatibilityMode = compatibilityMode;
+ }
+
+ @Test
+ public void testJobExecution() throws Exception {
+ var context = new AnnotationConfigApplicationContext();
+ context.register(TestConfiguration.class);
+ context.registerBean(DataSource.class, this::buildDataSource);
+ context.refresh();
+ var jobLauncher = context.getBean(JobLauncher.class);
+ var job = context.getBean(Job.class);
+
+ var jobExecution = jobLauncher.run(job, new JobParameters());
+
+ Assert.assertNotNull(jobExecution);
+ Assert.assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus());
+
+ var jdbcTemplate = new JdbcTemplate(context.getBean(DataSource.class));
+ jdbcTemplate.execute("SHUTDOWN");
+ }
+
+ private DataSource buildDataSource() {
+ var connectionUrl = String.format(
+ "jdbc:h2:mem:%s;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=false;MODE=%s",
+ UUID.randomUUID(),
+ this.compatibilityMode
+ );
+ var dataSource = new SimpleDriverDataSource(new org.h2.Driver(), connectionUrl, "sa", "");
+ var populator = new ResourceDatabasePopulator();
+ var resource = new DefaultResourceLoader()
+ .getResource("/org/springframework/batch/core/schema-h2.sql");
+ populator.addScript(resource);
+ DatabasePopulatorUtils.execute(populator, dataSource);
+ return dataSource;
+ }
+
+ @Configuration
+ @EnableBatchProcessing
+ static class TestConfiguration {
+ @Bean
+ Job job(JobBuilderFactory jobs, StepBuilderFactory steps) {
+ return jobs.get("job")
+ .start(steps.get("step")
+ .tasklet((contribution, chunkContext) -> RepeatStatus.FINISHED)
+ .build())
+ .build();
+ }
+ }
+
+ @Parameters
+ public static List