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/metadata/mgt/DeviceStatusManagementServiceImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/DeviceStatusManagementServiceImpl.java index 351ba5a63f..c04e5deae8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/DeviceStatusManagementServiceImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/metadata/mgt/DeviceStatusManagementServiceImpl.java @@ -151,9 +151,9 @@ public class DeviceStatusManagementServiceImpl implements DeviceStatusManagement if (metadataDAO.isExist(tenantId, MetadataConstants.IS_DEVICE_STATUS_CHECK_META_KEY)) { // Add default device status check metadata entries metadataDAO.updateMetadata(tenantId, constructDeviceStatusCheckMetadata(isChecked)); + MetadataManagementDAOFactory.commitTransaction(); return true; } - MetadataManagementDAOFactory.commitTransaction(); } catch (MetadataManagementDAOException e) { MetadataManagementDAOFactory.rollbackTransaction(); String msg = "Error occurred while updating device status check metadata entry.";