From ae131693774e346f159e8b99ba4a98a16dc632e4 Mon Sep 17 00:00:00 2001 From: ThilinaPremachandra Date: Fri, 16 Jun 2023 09:48:52 +0530 Subject: [PATCH] add rollback --- .../mgt/core/service/GroupManagementProviderServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java index 2dd39081a3..7c8f64768d 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/service/GroupManagementProviderServiceImpl.java @@ -167,6 +167,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid } else { DeviceGroup immediateParentGroup = groupDAO.getGroup(groups.getParentGroupId(), tenantId); if (immediateParentGroup == null) { + GroupManagementDAOFactory.rollbackTransaction(); String msg = "Parent group with group ID '" + groups.getParentGroupId() + "' does not exist. Hence creating of group '" + groups.getName() + "' was not success"; log.error(msg); throw new GroupManagementException(msg); @@ -182,7 +183,7 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid } else { throw new GroupManagementException("Group exist with name " + groups.getName()); } - } catch (GroupManagementDAOException | GroupManagementException e) { + } catch (GroupManagementDAOException e) { GroupManagementDAOFactory.rollbackTransaction(); String msg = e.getMessage(); log.error(msg, e);