From ed7e178ccbc0e38637f190167995b9e6a6bb0c92 Mon Sep 17 00:00:00 2001 From: cha Date: Tue, 17 Jun 2025 10:32:32 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=EB=B0=B0=EC=B9=98=202007=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/batch/BatchConfiguration.java | 56 +++++++++++++++++++ src/main/resources/config/application-dev.yml | 2 + 2 files changed, 58 insertions(+) create mode 100644 src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java diff --git a/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java b/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java new file mode 100644 index 00000000..108ea20b --- /dev/null +++ b/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java @@ -0,0 +1,56 @@ +package com.interplug.qcast.config.batch; + +import javax.sql.DataSource; +import org.springframework.batch.core.repository.JobRepository; +import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean; +import org.springframework.batch.support.DatabaseType; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.core.task.TaskExecutor; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.transaction.PlatformTransactionManager; + +/** + * Spring Batch Configuration for SQL Server without sequence support + */ +@Configuration +public class BatchConfiguration { + + /** + * Custom JobRepository that uses table-based ID generation instead of sequences + */ + @Bean + @Primary + public JobRepository jobRepository(DataSource dataSource, PlatformTransactionManager transactionManager) throws Exception { + JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean(); + factory.setDataSource(dataSource); + factory.setTransactionManager(transactionManager); + + // 테이블 prefix 설정 + factory.setTablePrefix("BATCH_"); + + // 격리 레벨 설정 + factory.setIsolationLevelForCreate("ISOLATION_SERIALIZABLE"); + + // SQL Server 데이터베이스 타입 설정 + factory.setDatabaseType(DatabaseType.SQLSERVER.getProductName()); + + factory.afterPropertiesSet(); + return factory.getObject(); + } + + /** + * TaskExecutor for async batch processing + */ + @Bean + public TaskExecutor batchTaskExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(5); + executor.setMaxPoolSize(10); + executor.setQueueCapacity(25); + executor.setThreadNamePrefix("batch-"); + executor.initialize(); + return executor; + } +} \ No newline at end of file diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index 0bd61c41..55e9d1c2 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -20,6 +20,8 @@ spring: batch: jdbc: initialize-schema: never + table-prefix: BATCH_ + schema: job: names: ${job.name:NONE} enabled: false From 760b00e8a46b0d954e301135376ee50f21552923 Mon Sep 17 00:00:00 2001 From: cha Date: Tue, 17 Jun 2025 13:34:27 +0900 Subject: [PATCH 2/7] =?UTF-8?q?=EB=B0=B0=EC=B9=98=202007=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interplug/qcast/config/batch/BatchConfiguration.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java b/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java index 108ea20b..a9a23b49 100644 --- a/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java +++ b/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java @@ -1,6 +1,8 @@ package com.interplug.qcast.config.batch; import javax.sql.DataSource; + +import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean; import org.springframework.batch.support.DatabaseType; @@ -15,6 +17,7 @@ import org.springframework.transaction.PlatformTransactionManager; * Spring Batch Configuration for SQL Server without sequence support */ @Configuration +@EnableBatchProcessing(modular = false) public class BatchConfiguration { /** @@ -34,8 +37,8 @@ public class BatchConfiguration { factory.setIsolationLevelForCreate("ISOLATION_SERIALIZABLE"); // SQL Server 데이터베이스 타입 설정 - factory.setDatabaseType(DatabaseType.SQLSERVER.getProductName()); - + //factory.setDatabaseType(DatabaseType.SQLSERVER.getProductName()); + factory.setDatabaseType("sqlserver"); factory.afterPropertiesSet(); return factory.getObject(); } From f720e6d19fd05a735c1580f68fe84a37687ca876 Mon Sep 17 00:00:00 2001 From: cha Date: Tue, 17 Jun 2025 14:25:19 +0900 Subject: [PATCH 3/7] =?UTF-8?q?=EB=B0=B0=EC=B9=98=202007=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interplug/qcast/config/batch/BatchConfiguration.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java b/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java index a9a23b49..8205abb5 100644 --- a/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java +++ b/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java @@ -5,6 +5,7 @@ import javax.sql.DataSource; import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean; +import org.springframework.batch.item.database.support.DefaultDataFieldMaxValueIncrementerFactory; import org.springframework.batch.support.DatabaseType; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -34,12 +35,13 @@ public class BatchConfiguration { factory.setTablePrefix("BATCH_"); // 격리 레벨 설정 - factory.setIsolationLevelForCreate("ISOLATION_SERIALIZABLE"); - + factory.setIsolationLevelForCreate("ISOLATION_READ_COMMITTED"); + factory.setIncrementerFactory(new DefaultDataFieldMaxValueIncrementerFactory(dataSource)); // SQL Server 데이터베이스 타입 설정 //factory.setDatabaseType(DatabaseType.SQLSERVER.getProductName()); factory.setDatabaseType("sqlserver"); factory.afterPropertiesSet(); + return factory.getObject(); } From d2f31f5c34f769c968e54b287d06c935c03f97d7 Mon Sep 17 00:00:00 2001 From: cha Date: Tue, 17 Jun 2025 15:24:49 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=EB=B0=B0=EC=B9=98=202007=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/batch/BatchConfiguration.java | 19 ++++++++----------- src/main/resources/config/application-dev.yml | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java b/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java index 8205abb5..ac743c0e 100644 --- a/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java +++ b/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java @@ -26,23 +26,20 @@ public class BatchConfiguration { */ @Bean @Primary - public JobRepository jobRepository(DataSource dataSource, PlatformTransactionManager transactionManager) throws Exception { + public JobRepository jobRepository(DataSource dataSource, + PlatformTransactionManager transactionManager) throws Exception { JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean(); factory.setDataSource(dataSource); factory.setTransactionManager(transactionManager); - - // 테이블 prefix 설정 - factory.setTablePrefix("BATCH_"); - - // 격리 레벨 설정 - factory.setIsolationLevelForCreate("ISOLATION_READ_COMMITTED"); - factory.setIncrementerFactory(new DefaultDataFieldMaxValueIncrementerFactory(dataSource)); - // SQL Server 데이터베이스 타입 설정 - //factory.setDatabaseType(DatabaseType.SQLSERVER.getProductName()); factory.setDatabaseType("sqlserver"); - factory.afterPropertiesSet(); + factory.setIsolationLevelForCreate("ISOLATION_READ_COMMITTED"); + // 시퀀스 없이 max(id)+1 방식으로 증가 + factory.setIncrementerFactory(new DefaultDataFieldMaxValueIncrementerFactory(dataSource)); + + factory.afterPropertiesSet(); return factory.getObject(); + } /** diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index 55e9d1c2..b655727c 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -24,7 +24,7 @@ spring: schema: job: names: ${job.name:NONE} - enabled: false + enabled: true profiles: scheduler: Y batch: From 7d6227b5e5fe4eff4ffba2929a5b7bfb0de4baad Mon Sep 17 00:00:00 2001 From: cha Date: Tue, 17 Jun 2025 16:33:00 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=EB=B0=B0=EC=B9=98=202008=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=88=98=EC=A0=95(yml,=20xml.=20java)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/batch/BatchConfiguration.java | 31 ++++++++++--------- src/main/resources/config/application-dev.yml | 2 +- src/main/resources/logback/logback-dev.xml | 10 ++++++ 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java b/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java index ac743c0e..0f1f7baf 100644 --- a/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java +++ b/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java @@ -1,12 +1,11 @@ package com.interplug.qcast.config.batch; + import javax.sql.DataSource; import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean; -import org.springframework.batch.item.database.support.DefaultDataFieldMaxValueIncrementerFactory; -import org.springframework.batch.support.DatabaseType; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; @@ -15,35 +14,39 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.transaction.PlatformTransactionManager; /** - * Spring Batch Configuration for SQL Server without sequence support + * Spring Batch configuration for SQL Server 2008 without sequence support. */ @Configuration -@EnableBatchProcessing(modular = false) +@EnableBatchProcessing public class BatchConfiguration { /** - * Custom JobRepository that uses table-based ID generation instead of sequences + * Configuring JobRepository for SQL Server 2008. + * Uses table-based ID generation instead of sequences. */ @Bean @Primary - public JobRepository jobRepository(DataSource dataSource, - PlatformTransactionManager transactionManager) throws Exception { + public JobRepository jobRepository(DataSource dataSource, PlatformTransactionManager transactionManager) throws Exception { JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean(); factory.setDataSource(dataSource); factory.setTransactionManager(transactionManager); - factory.setDatabaseType("sqlserver"); - factory.setIsolationLevelForCreate("ISOLATION_READ_COMMITTED"); - // 시퀀스 없이 max(id)+1 방식으로 증가 - factory.setIncrementerFactory(new DefaultDataFieldMaxValueIncrementerFactory(dataSource)); + // Use TABLE_PREFIX to map to Spring Batch tables + factory.setTablePrefix("BATCH_"); + // Isolation level setting for SQL Server + factory.setIsolationLevelForCreate("ISOLATION_SERIALIZABLE"); + + // Set to "SQLSERVER" for Spring Batch compatibility + factory.setDatabaseType("SQLSERVER"); + + // Finalize factory setup factory.afterPropertiesSet(); return factory.getObject(); - } /** - * TaskExecutor for async batch processing + * TaskExecutor for batch processing (multithreading support). */ @Bean public TaskExecutor batchTaskExecutor() { @@ -51,7 +54,7 @@ public class BatchConfiguration { executor.setCorePoolSize(5); executor.setMaxPoolSize(10); executor.setQueueCapacity(25); - executor.setThreadNamePrefix("batch-"); + executor.setThreadNamePrefix("batch-thread-"); executor.initialize(); return executor; } diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index b655727c..55e9d1c2 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -24,7 +24,7 @@ spring: schema: job: names: ${job.name:NONE} - enabled: true + enabled: false profiles: scheduler: Y batch: diff --git a/src/main/resources/logback/logback-dev.xml b/src/main/resources/logback/logback-dev.xml index 0356cb1d..d13a536a 100644 --- a/src/main/resources/logback/logback-dev.xml +++ b/src/main/resources/logback/logback-dev.xml @@ -36,4 +36,14 @@ + + + + + + + + + + \ No newline at end of file From 7cb8ac8cc5114dad70beed871e3f89828f4e390c Mon Sep 17 00:00:00 2001 From: cha Date: Wed, 18 Jun 2025 13:40:10 +0900 Subject: [PATCH 6/7] =?UTF-8?q?=EC=8A=A4=ED=94=84=EB=A7=81=20=EB=B0=B0?= =?UTF-8?q?=EC=B9=98=206/18=5F1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/batch/BatchConfiguration.java | 11 +++ ...ltDataFieldMaxValueIncrementerFactory.java | 22 +++++ .../qcast/config/batch/CustomIncrementer.java | 39 ++++++++ .../qcast/config/batch/SqlServer.sql | 94 +++++++++++++++++++ src/main/resources/config/application-dev.yml | 2 - .../resources/config/application-local.yml | 16 ---- 6 files changed, 166 insertions(+), 18 deletions(-) create mode 100644 src/main/java/com/interplug/qcast/config/batch/CustomDefaultDataFieldMaxValueIncrementerFactory.java create mode 100644 src/main/java/com/interplug/qcast/config/batch/CustomIncrementer.java create mode 100644 src/main/java/com/interplug/qcast/config/batch/SqlServer.sql diff --git a/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java b/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java index 0f1f7baf..e26a9246 100644 --- a/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java +++ b/src/main/java/com/interplug/qcast/config/batch/BatchConfiguration.java @@ -6,6 +6,7 @@ import javax.sql.DataSource; import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean; +import org.springframework.batch.item.database.support.DataFieldMaxValueIncrementerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; @@ -30,6 +31,8 @@ public class BatchConfiguration { JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean(); factory.setDataSource(dataSource); factory.setTransactionManager(transactionManager); + factory.setIncrementerFactory(new CustomDefaultDataFieldMaxValueIncrementerFactory(dataSource)); + // Use TABLE_PREFIX to map to Spring Batch tables factory.setTablePrefix("BATCH_"); @@ -38,6 +41,7 @@ public class BatchConfiguration { factory.setIsolationLevelForCreate("ISOLATION_SERIALIZABLE"); // Set to "SQLSERVER" for Spring Batch compatibility + factory.setDatabaseType("SQLSERVER"); // Finalize factory setup @@ -45,6 +49,13 @@ public class BatchConfiguration { return factory.getObject(); } + @Bean + public DataFieldMaxValueIncrementerFactory customIncrementerFactory(DataSource dataSource) { + return new CustomDefaultDataFieldMaxValueIncrementerFactory(dataSource); + } + + + /** * TaskExecutor for batch processing (multithreading support). */ diff --git a/src/main/java/com/interplug/qcast/config/batch/CustomDefaultDataFieldMaxValueIncrementerFactory.java b/src/main/java/com/interplug/qcast/config/batch/CustomDefaultDataFieldMaxValueIncrementerFactory.java new file mode 100644 index 00000000..f005f042 --- /dev/null +++ b/src/main/java/com/interplug/qcast/config/batch/CustomDefaultDataFieldMaxValueIncrementerFactory.java @@ -0,0 +1,22 @@ +package com.interplug.qcast.config.batch; + +import org.springframework.batch.item.database.support.DefaultDataFieldMaxValueIncrementerFactory; +import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; +import org.springframework.jdbc.support.incrementer.SqlServerSequenceMaxValueIncrementer; + +import javax.sql.DataSource; + +public class CustomDefaultDataFieldMaxValueIncrementerFactory extends DefaultDataFieldMaxValueIncrementerFactory { + private final DataSource dataSource; + + public CustomDefaultDataFieldMaxValueIncrementerFactory(DataSource dataSource) { + super(dataSource); + this.dataSource = dataSource; + } + @Override + public DataFieldMaxValueIncrementer getIncrementer(String databaseType, String incrementerName) { + CustomIncrementer customIncrementer = new CustomIncrementer(this.dataSource, incrementerName); + return customIncrementer; + } + +} \ No newline at end of file diff --git a/src/main/java/com/interplug/qcast/config/batch/CustomIncrementer.java b/src/main/java/com/interplug/qcast/config/batch/CustomIncrementer.java new file mode 100644 index 00000000..2f4ea0f8 --- /dev/null +++ b/src/main/java/com/interplug/qcast/config/batch/CustomIncrementer.java @@ -0,0 +1,39 @@ +package com.interplug.qcast.config.batch; + +import org.springframework.jdbc.support.incrementer.AbstractColumnMaxValueIncrementer; +import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; + +import javax.sql.DataSource; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +public class CustomIncrementer extends AbstractColumnMaxValueIncrementer { + + public CustomIncrementer(DataSource dataSource, String incrementerName) { + super(dataSource, incrementerName, "ID"); + } + + @Override + protected long getNextKey() { + long nextKey = 0; + try (Connection conn = this.getDataSource().getConnection()) { + PreparedStatement psSelect = conn.prepareStatement("SELECT ID FROM " + getIncrementerName() + " WITH (UPDLOCK, HOLDLOCK)"); + ResultSet rs = psSelect.executeQuery(); + if (rs.next()) { + nextKey = rs.getLong(1); + } + rs.close(); + psSelect.close(); + + PreparedStatement psUpdate = conn.prepareStatement("UPDATE " + getIncrementerName() + " SET ID = ?"); + psUpdate.setLong(1, nextKey + 1); + psUpdate.executeUpdate(); + psUpdate.close(); + } catch (SQLException e) { + throw new RuntimeException("Could not get next key for " + getIncrementerName(), e); + } + return nextKey + 1; + } + +} diff --git a/src/main/java/com/interplug/qcast/config/batch/SqlServer.sql b/src/main/java/com/interplug/qcast/config/batch/SqlServer.sql new file mode 100644 index 00000000..34e5dfdc --- /dev/null +++ b/src/main/java/com/interplug/qcast/config/batch/SqlServer.sql @@ -0,0 +1,94 @@ +CREATE TABLE BATCH_JOB_INSTANCE ( + JOB_INSTANCE_ID BIGINT NOT NULL PRIMARY KEY , + VERSION BIGINT NULL, + 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 NOT NULL PRIMARY KEY , + VERSION BIGINT NULL, + JOB_INSTANCE_ID BIGINT NOT NULL, + CREATE_TIME DATETIME NOT NULL, + START_TIME DATETIME DEFAULT NULL , + END_TIME DATETIME DEFAULT NULL , + STATUS VARCHAR(10) NULL, + EXIT_CODE VARCHAR(2500) NULL, + EXIT_MESSAGE VARCHAR(2500) NULL, + LAST_UPDATED DATETIME 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 , + PARAMETER_NAME VARCHAR(100) NOT NULL , + PARAMETER_TYPE VARCHAR(100) NOT NULL , + PARAMETER_VALUE VARCHAR(2500) , + 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 NOT NULL PRIMARY KEY , + VERSION BIGINT NOT NULL, + STEP_NAME VARCHAR(100) NOT NULL, + JOB_EXECUTION_ID BIGINT NOT NULL, + CREATE_TIME DATETIME NOT NULL, + START_TIME DATETIME DEFAULT NULL , + END_TIME DATETIME DEFAULT NULL , + STATUS VARCHAR(10) NULL, + COMMIT_COUNT BIGINT NULL, + READ_COUNT BIGINT NULL, + FILTER_COUNT BIGINT NULL, + WRITE_COUNT BIGINT NULL, + READ_SKIP_COUNT BIGINT NULL, + WRITE_SKIP_COUNT BIGINT NULL, + PROCESS_SKIP_COUNT BIGINT NULL, + ROLLBACK_COUNT BIGINT NULL, + EXIT_CODE VARCHAR(2500) NULL, + EXIT_MESSAGE VARCHAR(2500) NULL, + LAST_UPDATED DATETIME NULL, + 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 VARCHAR(MAX) NULL, + 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 VARCHAR(MAX) NULL, + constraint JOB_EXEC_CTX_FK foreign key (JOB_EXECUTION_ID) + references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID) +) ; + +CREATE TABLE BATCH_JOB_SEQ ( + ID BIGINT NOT NULL PRIMARY KEY, + NEXT_VAL BIGINT NOT NULL +); + +-- 첫 번째 ID 값 초기화 +INSERT INTO BATCH_JOB_SEQ (ID, NEXT_VAL) VALUES (1, 1); + + +CREATE TABLE BATCH_JOB_EXECUTION_SEQ ( + ID BIGINT PRIMARY KEY +); + +INSERT INTO BATCH_JOB_EXECUTION_SEQ (ID) VALUES (1); + +CREATE TABLE BATCH_STEP_EXECUTION_SEQ ( + ID BIGINT NOT NULL PRIMARY KEY +); + +-- 초기 키 값을 삽입 +INSERT INTO BATCH_STEP_EXECUTION_SEQ (ID) VALUES (0); diff --git a/src/main/resources/config/application-dev.yml b/src/main/resources/config/application-dev.yml index 55e9d1c2..0bd61c41 100644 --- a/src/main/resources/config/application-dev.yml +++ b/src/main/resources/config/application-dev.yml @@ -20,8 +20,6 @@ spring: batch: jdbc: initialize-schema: never - table-prefix: BATCH_ - schema: job: names: ${job.name:NONE} enabled: false diff --git a/src/main/resources/config/application-local.yml b/src/main/resources/config/application-local.yml index b165146a..d70bbfa8 100644 --- a/src/main/resources/config/application-local.yml +++ b/src/main/resources/config/application-local.yml @@ -15,21 +15,6 @@ spring: username: pvDBuser maximum-pool-size: 4 pool-name: Master-HikariPool - # datasource: - # master: - # driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - # jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true - # username: pvDBuser - # password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck) - # maximum-pool-size: 4 - # pool-name: Master-HikariPool - # read: - # driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy - # jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true - # username: pvDBuser - # password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck) - # maximum-pool-size: 4 - # pool-name: Read-HikariPool jackson: time-zone: Asia/Seoul batch: @@ -40,7 +25,6 @@ spring: enabled: false profiles: scheduler: Y - batch: job: enabled: true From 01f9e610f2b2655bdcd6f6ea998399667c58ce3e Mon Sep 17 00:00:00 2001 From: cha Date: Wed, 18 Jun 2025 14:02:52 +0900 Subject: [PATCH 7/7] =?UTF-8?q?=EC=8A=A4=ED=94=84=EB=A7=81=20=EB=B0=B0?= =?UTF-8?q?=EC=B9=98=20(=EC=9A=B4=EC=98=81)6/18=5F1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../interplug/qcast/batch/JobLauncherController.java | 12 ++++++------ src/main/resources/logback/logback-local.xml | 11 +++++++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/interplug/qcast/batch/JobLauncherController.java b/src/main/java/com/interplug/qcast/batch/JobLauncherController.java index b175df11..62751ac5 100644 --- a/src/main/java/com/interplug/qcast/batch/JobLauncherController.java +++ b/src/main/java/com/interplug/qcast/batch/JobLauncherController.java @@ -151,9 +151,9 @@ public class JobLauncherController { JobParameters jobParameters = new JobParametersBuilder().addDate("time", new Date()).toJobParameters(); - if (batchJobEnabled) { + //if (batchJobEnabled) { jobLauncher.run(job, jobParameters); - } + //} } return "OK"; } @@ -181,9 +181,9 @@ public class JobLauncherController { JobParameters jobParameters = new JobParametersBuilder().addDate("time", new Date()).toJobParameters(); - if (batchJobEnabled) { + //if (batchJobEnabled) { jobLauncher.run(job, jobParameters); - } + //} } return "OK"; @@ -274,9 +274,9 @@ public class JobLauncherController { JobParameters jobParameters = new JobParametersBuilder().addDate("time", new Date()).toJobParameters(); - if (batchJobEnabled) { + // if (batchJobEnabled) { jobLauncher.run(job, jobParameters); - } + // } } return "OK"; diff --git a/src/main/resources/logback/logback-local.xml b/src/main/resources/logback/logback-local.xml index 2b75f05f..43c24fb9 100644 --- a/src/main/resources/logback/logback-local.xml +++ b/src/main/resources/logback/logback-local.xml @@ -36,4 +36,15 @@ + + + + + + + + + + + \ No newline at end of file