From 4f8e8ba1ae9a2fa815e8ff918d6fe0d8da69b1e5 Mon Sep 17 00:00:00 2001 From: CRoberto1926 <3205022+CRoberto1926@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:55:10 +0200 Subject: [PATCH] Closes #2634: Add TaskanaEngine.clearSessionCache to clear cache of underlying SQL session --- .../src/main/java/pro/taskana/common/api/TaskanaEngine.java | 3 +++ .../java/pro/taskana/common/internal/TaskanaEngineImpl.java | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/lib/taskana-core/src/main/java/pro/taskana/common/api/TaskanaEngine.java b/lib/taskana-core/src/main/java/pro/taskana/common/api/TaskanaEngine.java index 111c02efe6..62c19c1561 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/common/api/TaskanaEngine.java +++ b/lib/taskana-core/src/main/java/pro/taskana/common/api/TaskanaEngine.java @@ -246,6 +246,9 @@ default void runAsAdmin(Runnable runnable) { */ CurrentUserContext getCurrentUserContext(); + /** Clears the cache of the underlying local SQL session. */ + void clearSqlSessionCache(); + /** * Connection management mode. Controls the connection handling of taskana * diff --git a/lib/taskana-core/src/main/java/pro/taskana/common/internal/TaskanaEngineImpl.java b/lib/taskana-core/src/main/java/pro/taskana/common/internal/TaskanaEngineImpl.java index 7ebd4971ef..4dec297384 100644 --- a/lib/taskana-core/src/main/java/pro/taskana/common/internal/TaskanaEngineImpl.java +++ b/lib/taskana-core/src/main/java/pro/taskana/common/internal/TaskanaEngineImpl.java @@ -385,6 +385,11 @@ public CurrentUserContext getCurrentUserContext() { return currentUserContext; } + @Override + public void clearSqlSessionCache() { + sessionManager.clearCache(); + } + /** * This method creates the sqlSessionManager of myBatis. It integrates all the SQL mappers and * sets the databaseId attribute.