From f70719aecbd3f20e36fa5591ac935f77cdf183ca Mon Sep 17 00:00:00 2001 From: hjjeong Date: Wed, 13 May 2026 11:56:40 +0900 Subject: [PATCH] =?UTF-8?q?fix(batch):=20batch=5Fexecution=5Flogs=20?= =?UTF-8?q?=EC=9D=98=20VARCHAR=20=EC=88=AB=EC=9E=90=20=EC=BB=AC=EB=9F=BC?= =?UTF-8?q?=EC=97=90=20=EB=AA=85=EC=8B=9C=EC=A0=81=20String=20=EC=A0=84?= =?UTF-8?q?=EB=8B=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 운영 DB 검증 결과 batch_execution_logs.duration_ms / total_records / success_records / failed_records 가 모두 character varying 으로 정의됨 (V001 legacy 마이그레이션 흔적). PgJDBC 가 Long/Integer 를 VARCHAR 컬럼에 자동 변환하지 못할 위험이 있어 명시적으로 String.valueOf 로 변환 후 전달. mapper 의 COALESCE default 가 '0' (문자열) 인 점과도 일관. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../com/erp/service/BatchManagementService.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/backend-spring/src/main/java/com/erp/service/BatchManagementService.java b/backend-spring/src/main/java/com/erp/service/BatchManagementService.java index c69f202f..ff0767a2 100644 --- a/backend-spring/src/main/java/com/erp/service/BatchManagementService.java +++ b/backend-spring/src/main/java/com/erp/service/BatchManagementService.java @@ -157,17 +157,18 @@ public class BatchManagementService extends BaseService { long duration = System.currentTimeMillis() - startMs; // 3. 실행 로그 UPDATE — 최종 상태/카운트/duration 마무리 + // 주의: batch_execution_logs 의 duration_ms / *_records 컬럼은 운영 DB 에서 VARCHAR + // (V001 legacy 마이그레이션 흔적). PgJDBC 가 Long/Integer 를 VARCHAR 로 자동 변환하지 못할 수 있어 + // 명시적으로 String 으로 보낸다. mapper 의 COALESCE default 도 '0' (문자열) 이라 일관됨. if (logId != null) { Map updateLog = new LinkedHashMap<>(); updateLog.put("id", logId); updateLog.put("execution_status", status); - // PostgreSQL JDBC 드라이버가 Timestamp → timestamp 자동 변환. - // mapper 의 #{end_time}::timestamp 캐스트는 noop 으로 안전. updateLog.put("end_time", new java.sql.Timestamp(System.currentTimeMillis())); - updateLog.put("duration_ms", duration); - updateLog.put("total_records", execResult != null ? execResult.totalRecords : 0); - updateLog.put("success_records", execResult != null ? execResult.successRecords : 0); - updateLog.put("failed_records", execResult != null ? execResult.failedRecords : 0); + updateLog.put("duration_ms", String.valueOf(duration)); + updateLog.put("total_records", String.valueOf(execResult != null ? execResult.totalRecords : 0)); + updateLog.put("success_records", String.valueOf(execResult != null ? execResult.successRecords : 0)); + updateLog.put("failed_records", String.valueOf(execResult != null ? execResult.failedRecords : 0)); if (errorMessage != null) updateLog.put("error_message", errorMessage); try { sqlSession.update(EXEC_LOG_NS + "updateBatchExecutionLog", updateLog);