From 5c7cfda487742679bd3ef6fa6df8ca5920f531bc Mon Sep 17 00:00:00 2001 From: lakshani Date: Fri, 24 Mar 2017 15:42:54 +0530 Subject: [PATCH] Fixed jira IOTS-438 --- .../mgt/core/service/DeviceManagementProviderServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index f7d268642f..f89fe627c3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -269,7 +269,9 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv DeviceManagementDAOFactory.beginTransaction(); Device currentDevice = deviceDAO.getDevice(deviceIdentifier, tenantId); device.setId(currentDevice.getId()); - device.getEnrolmentInfo().setId(currentDevice.getEnrolmentInfo().getId()); + if (device.getEnrolmentInfo().getId() == 0) { + device.getEnrolmentInfo().setId(currentDevice.getEnrolmentInfo().getId()); + } if (device.getName() == null) { device.setName(currentDevice.getName()); }