From 7697f109c5c38b81cf5ae3320d5dd944cfde1f9b 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 d67b0e62b7..7ff0273041 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 @@ -226,6 +226,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 73d5da160a..72853e6c8f 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 @@ -371,6 +371,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.