From 432daef543378cdb7e54989053e2234a802b94ba Mon Sep 17 00:00:00 2001 From: Martin Ledvinka Date: Mon, 2 Dec 2024 10:44:07 +0100 Subject: [PATCH] [kbss-cvut/termit-ui#581] Fix EntityExistsExceptions being thrown when importing translations to more complex vocabularies. --- .../cvut/kbss/termit/service/importer/excel/ExcelImporter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/cz/cvut/kbss/termit/service/importer/excel/ExcelImporter.java b/src/main/java/cz/cvut/kbss/termit/service/importer/excel/ExcelImporter.java index f588798d1..5de0002d8 100644 --- a/src/main/java/cz/cvut/kbss/termit/service/importer/excel/ExcelImporter.java +++ b/src/main/java/cz/cvut/kbss/termit/service/importer/excel/ExcelImporter.java @@ -256,6 +256,8 @@ public Vocabulary importTermTranslations(@Nonnull URI vocabularyIri, @Nonnull Im } mergeTranslations(t, existingTerm.get()); termService.update(existingTerm.get()); + // Flush changes to prevent EntityExistsExceptions when term is already managed in PC as different type (Term vs TermInfo) + em.flush(); }); } catch (IOException e) { throw new VocabularyImportException("Unable to read input as Excel.", e);