From eda690168dcfd9bcb227244e4c9e6c81776d7974 Mon Sep 17 00:00:00 2001 From: Mukhiddin Yusupov Date: Sat, 17 Aug 2024 01:41:27 +0500 Subject: [PATCH] MSEARCH-794: fix status setting query --- .../service/reindex/jdbc/ReindexStatusRepository.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/folio/search/service/reindex/jdbc/ReindexStatusRepository.java b/src/main/java/org/folio/search/service/reindex/jdbc/ReindexStatusRepository.java index 28952d0fa..1b4fcc7cf 100644 --- a/src/main/java/org/folio/search/service/reindex/jdbc/ReindexStatusRepository.java +++ b/src/main/java/org/folio/search/service/reindex/jdbc/ReindexStatusRepository.java @@ -39,7 +39,7 @@ public class ReindexStatusRepository { private static final String UPDATE_FOR_ENTITIES_SQL = """ UPDATE %s SET %s - WHERE entity_type in (?); + WHERE entity_type in (%s); """; private final FolioExecutionContext context; @@ -65,12 +65,11 @@ public void setReindexMergeFailed(List entityTypes) { .collect(Collectors.joining(",")); var fullTableName = getFullTableName(context, REINDEX_STATUS_TABLE); var sql = UPDATE_FOR_ENTITIES_SQL.formatted( - fullTableName, "%s = ?, %s = ?".formatted(STATUS_COLUMN, END_TIME_MERGE_COLUMN)); + fullTableName, "%s = ?, %s = ?".formatted(STATUS_COLUMN, END_TIME_MERGE_COLUMN), inTypes); log.info("inTypes: {}", inTypes); log.info("sql: {}", sql); - var status = "'%s'".formatted(ReindexStatus.MERGE_FAILED.name()); - jdbcTemplate.update(sql, status, Timestamp.from(Instant.now()), inTypes); + jdbcTemplate.update(sql, ReindexStatus.MERGE_FAILED.name(), Timestamp.from(Instant.now()), inTypes); } public void saveReindexStatusRecords(List statusRecords) {