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/dao/impl/TenantDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java index 69abf756a0f..5aec24752bf 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java @@ -207,7 +207,7 @@ public class TenantDAOImpl implements TenantDAO { public void deleteDeviceOperationResponseByTenantId(int tenantId) throws DeviceManagementDAOException { try { Connection conn = DeviceManagementDAOFactory.getConnection(); - String sql = "DELETE FROM DM_DEVICE_OPERATION_RESPONSE WHERE ID IN " + + String sql = "DELETE FROM DM_DEVICE_OPERATION_RESPONSE WHERE EN_OP_MAP_ID IN " + "(SELECT ID FROM DM_ENROLMENT_OP_MAPPING WHERE TENANT_ID = ?)"; try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); @@ -786,7 +786,7 @@ public class TenantDAOImpl implements TenantDAO { public void deleteExternalDeviceMappingByTenantId(int tenantId) throws DeviceManagementDAOException { try { Connection conn = DeviceManagementDAOFactory.getConnection(); - String sql = "DELETE FROM DM_OTP_DATA WHERE TENANT_ID = ?"; + String sql = "DELETE FROM DM_EXT_DEVICE_MAPPING WHERE TENANT_ID = ?"; try (PreparedStatement stmt = conn.prepareStatement(sql)) { stmt.setInt(1, tenantId); stmt.executeUpdate(); 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/DeviceManagementProviderServiceImpl.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/DeviceManagementProviderServiceImpl.java index 3477fc25896..7aad6f8f2ea 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/DeviceManagementProviderServiceImpl.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/DeviceManagementProviderServiceImpl.java @@ -5221,8 +5221,8 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv tenantDao.deleteAppIconsByTenantId(tenantId); tenantDao.deleteTraccarUnsyncedDevicesByTenantId(tenantId); tenantDao.deleteDeviceEventGroupMappingByTenantId(tenantId); - tenantDao.deleteDeviceEventByTenantId(tenantId); tenantDao.deleteGeofenceEventMappingByTenantId(tenantId); + tenantDao.deleteDeviceEventByTenantId(tenantId); tenantDao.deleteGeofenceGroupMappingByTenantId(tenantId); tenantDao.deleteGeofenceByTenantId(tenantId); tenantDao.deleteDeviceGroupPolicyByTenantId(tenantId); diff --git a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java index bd7351d5f89..00cdc801be6 100644 --- a/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java +++ b/components/tenant-mgt/io.entgra.device.mgt.core.tenant.mgt.core/src/main/java/io/entgra/device/mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java @@ -157,8 +157,8 @@ public class TenantManagerImpl implements TenantManager { tenantDao.deleteAppIconsByTenantId(tenantId); tenantDao.deleteTraccarUnsyncedDevicesByTenantId(tenantId); tenantDao.deleteDeviceEventGroupMappingByTenantId(tenantId); - tenantDao.deleteDeviceEventByTenantId(tenantId); tenantDao.deleteGeofenceEventMappingByTenantId(tenantId); + tenantDao.deleteDeviceEventByTenantId(tenantId); tenantDao.deleteGeofenceGroupMappingByTenantId(tenantId); tenantDao.deleteGeofenceByTenantId(tenantId); tenantDao.deleteDeviceGroupPolicyByTenantId(tenantId);