From 16199a7311bea0b4674607553e1b8d6c8bcc5bdd Mon Sep 17 00:00:00 2001 From: ashvini Date: Tue, 9 Apr 2024 00:10:15 +0530 Subject: [PATCH] Fix DAO error in Tenant Deletion Fix errors Fix errors --- .../mgt/core/device/mgt/core/dao/impl/TenantDAOImpl.java | 4 ++-- .../mgt/core/service/DeviceManagementProviderServiceImpl.java | 2 +- .../mgt/core/tenant/mgt/core/impl/TenantManagerImpl.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) 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 69abf756a0..5aec24752b 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 3477fc2589..7aad6f8f2e 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 bd7351d5f8..00cdc801be 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);