From de23d31ce74f74e96104e8f43cb6ad33c76aa7f1 Mon Sep 17 00:00:00 2001 From: "Michal J. Sladek" Date: Fri, 12 Jul 2024 00:10:43 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Test=20som=20feiler=20p=C3=A5=20interval?= =?UTF-8?q?=20cast=20to=20string.=20(#647)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../no/nav/vedtak/felles/prosesstask/impl/StartupData.java | 6 ++---- .../felles/prosesstask/impl/TaskManagerRepositoryImpl.java | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/task/src/main/java/no/nav/vedtak/felles/prosesstask/impl/StartupData.java b/task/src/main/java/no/nav/vedtak/felles/prosesstask/impl/StartupData.java index d710e373..c0a45561 100644 --- a/task/src/main/java/no/nav/vedtak/felles/prosesstask/impl/StartupData.java +++ b/task/src/main/java/no/nav/vedtak/felles/prosesstask/impl/StartupData.java @@ -1,7 +1,5 @@ package no.nav.vedtak.felles.prosesstask.impl; -import java.time.LocalDateTime; - import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; @@ -20,7 +18,7 @@ class StartupData { String inputtid; @Column(name="inputtid2") - LocalDateTime inputtid2; + String inputtid2; @Column(name="drift") String drift; @@ -29,7 +27,7 @@ class StartupData { // for hibernate } - public StartupData(String dbtz, String dbtid, String inputtid, LocalDateTime inputtid2, String drift) { + public StartupData(String dbtz, String dbtid, String inputtid, String inputtid2, String drift) { this.dbtz = dbtz; this.dbtid = dbtid; this.inputtid = inputtid; diff --git a/task/src/main/java/no/nav/vedtak/felles/prosesstask/impl/TaskManagerRepositoryImpl.java b/task/src/main/java/no/nav/vedtak/felles/prosesstask/impl/TaskManagerRepositoryImpl.java index 982a06e7..5ffa28a8 100644 --- a/task/src/main/java/no/nav/vedtak/felles/prosesstask/impl/TaskManagerRepositoryImpl.java +++ b/task/src/main/java/no/nav/vedtak/felles/prosesstask/impl/TaskManagerRepositoryImpl.java @@ -386,13 +386,13 @@ private void logDatabaseDetaljer() { + " to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SS.US+TZ') as dbtid," + " to_char(cast(:inputTid as timestamp with time zone), 'YYYY-MM-DD HH24:MI:SS.US+TZ') as inputtid," + " :inputTid as inputtid2," - + " (current_timestamp - :inputTid) as drift"; + + " to_char((current_timestamp - :inputTid), 'YYYY-MM-DD HH24:MI:SS.US') as drift"; } else if (DatabaseUtil.isOracle(entityManager)) { sql = "select DBTIMEZONE as dbtz," + " to_char(current_timestamp, 'YYYY-MM-DD HH24:MI:SSxFF6+TZH:TZM') as dbtid," + " to_char(cast(:inputTid as timestamp with time zone), 'YYYY-MM-DD HH24:MI:SSxFF6+TZH:TZM') as inputtid," + " :inputTid as inputtid2," - + " (current_timestamp - :inputTid) as drift" + + " to_char((current_timestamp - :inputTid), 'YYYY-MM-DD HH24:MI:SSxFF6') as drift" + " from dual"; } else { throw new UnsupportedOperationException("Unsupported Database: " + DatabaseUtil.getDialect(entityManager));