fix(batch): batch_execution_logs 의 VARCHAR 숫자 컬럼에 명시적 String 전달
운영 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) <noreply@anthropic.com>
This commit is contained in:
@@ -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<String, Object> 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);
|
||||
|
||||
Reference in New Issue
Block a user