From 4c0026f0017aa5b57d2e0d4ad65a5b73338bc7a5 Mon Sep 17 00:00:00 2001 From: Jakob Havstein Eriksen Date: Sat, 13 Apr 2024 21:59:36 +0200 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Bytt=20fra=20=3F=20til=20n?= =?UTF-8?q?amed=20parameters=20i=20CommandContextDao?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../no/nav/helse/modell/CommandContextDao.kt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/spesialist-selve/src/main/kotlin/no/nav/helse/modell/CommandContextDao.kt b/spesialist-selve/src/main/kotlin/no/nav/helse/modell/CommandContextDao.kt index 629ad8c89..5ff38875e 100644 --- a/spesialist-selve/src/main/kotlin/no/nav/helse/modell/CommandContextDao.kt +++ b/spesialist-selve/src/main/kotlin/no/nav/helse/modell/CommandContextDao.kt @@ -94,15 +94,20 @@ internal class CommandContextDao(private val dataSource: DataSource) { sessionOf(dataSource).use { @Language("PostgreSQL") val query = - """INSERT INTO command_context(context_id,hendelse_id,tilstand,data,hash) VALUES (?, ?, ?, ?::json, ?)""" + """ + INSERT INTO command_context(context_id, hendelse_id, tilstand, data, hash) + VALUES (:contextId, :hendelseId, :tilstand, :data::json, :hash) + """.trimIndent() it.run( queryOf( query, - contextId, - hendelseId, - tilstand.name, - mapper.writeValueAsString(CommandContextDto(sti)), - hash, + mapOf( + "contextId" to contextId, + "hendelseId" to hendelseId, + "tilstand" to tilstand.name, + "data" to mapper.writeValueAsString(CommandContextDto(sti)), + "hash" to hash, + ), ).asExecute, ) }