From bb80d5b7b2147f75ba8566b23ecfdf6ac80698c3 Mon Sep 17 00:00:00 2001 From: Obinna Henry <55580796+obinna-h-n@users.noreply.github.com> Date: Fri, 24 Jan 2025 15:43:55 +0100 Subject: [PATCH] fix error where customizable enum entity disease column is an empty string (instead of null) when the dto disease collection is empty. --- .../customizableenum/CustomizableEnumFacadeEjb.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sormas-backend/src/main/java/de/symeda/sormas/backend/customizableenum/CustomizableEnumFacadeEjb.java b/sormas-backend/src/main/java/de/symeda/sormas/backend/customizableenum/CustomizableEnumFacadeEjb.java index 9de113916a6..a09544d9e64 100644 --- a/sormas-backend/src/main/java/de/symeda/sormas/backend/customizableenum/CustomizableEnumFacadeEjb.java +++ b/sormas-backend/src/main/java/de/symeda/sormas/backend/customizableenum/CustomizableEnumFacadeEjb.java @@ -134,7 +134,11 @@ protected CustomizableEnumValue fillOrBuildEntity(CustomizableEnumValueDto sourc target.setValue(source.getValue()); target.setCaption(source.getCaption()); target.setTranslations(source.getTranslations()); - target.setDiseases(source.getDiseases()); + if (!source.getDiseases().isEmpty()) { + target.setDiseases(source.getDiseases()); + } else { + target.setDiseases(null); + } target.setDescription(source.getDescription()); target.setDescriptionTranslations(source.getDescriptionTranslations()); target.setProperties(source.getProperties()); @@ -496,7 +500,9 @@ public CustomizableEnumValueDto toDto(CustomizableEnumValue source) { target.setValue(source.getValue()); target.setCaption(source.getCaption()); target.setTranslations(source.getTranslations()); - target.setDiseases(source.getDiseases()); + if (source.getDiseases() != null) { + target.setDiseases(source.getDiseases()); + } target.setDescription(source.getDescription()); target.setDescriptionTranslations(source.getDescriptionTranslations()); target.setProperties(source.getProperties());