From 748c28d36898455d9f1e1afea5c8624ab809d041 Mon Sep 17 00:00:00 2001 From: "osh.silva" Date: Mon, 29 Jul 2024 16:21:01 +0530 Subject: [PATCH] Fix ambigous column error --- .../dao/impl/device/GenericDeviceDAOImpl.java | 20 +++++++++---------- .../DeviceManagementProviderServiceImpl.java | 2 -- 2 files changed, 10 insertions(+), 12 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/device/GenericDeviceDAOImpl.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/device/GenericDeviceDAOImpl.java index 5710e0181f..85b4b5553d 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/device/GenericDeviceDAOImpl.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/device/GenericDeviceDAOImpl.java @@ -225,11 +225,11 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { try { Connection conn = getConnection(); String sql = "SELECT d.ID AS DEVICE_ID, " + - "DEVICE_IDENTIFICATION, " + + "d.DEVICE_IDENTIFICATION, " + "DESCRIPTION, " + "NAME, " + "DATE_OF_ENROLMENT, " + - "LAST_UPDATED_TIMESTAMP, " + + "d.LAST_UPDATED_TIMESTAMP, " + "STATUS, " + "DATE_OF_LAST_UPDATE, " + "TIMESTAMPDIFF(DAY, ?, DATE_OF_ENROLMENT) as DAYS_SINCE_ENROLLED " + @@ -266,12 +266,12 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { try { conn = this.getConnection(); String sql = "select d.ID AS DEVICE_ID, " + - "DEVICE_IDENTIFICATION, " + + "d.DEVICE_IDENTIFICATION, " + "DESCRIPTION, " + "NAME, " + "DATE_OF_ENROLMENT, " + "DATE_OF_LAST_UPDATE, " + - "d1.LAST_UPDATED_TIMESTAMP, " + + "d.LAST_UPDATED_TIMESTAMP, " + "STATUS, " + "TIMESTAMPDIFF(DAY, DATE_OF_LAST_UPDATE, DATE_OF_ENROLMENT) AS DAYS_USED " + "from DM_DEVICE d, DM_ENROLMENT e " + @@ -311,11 +311,11 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { try { conn = this.getConnection(); String sql = "select d.ID AS DEVICE_ID, " + - "DEVICE_IDENTIFICATION, " + + "d.DEVICE_IDENTIFICATION, " + "DESCRIPTION, " + "NAME, " + "DATE_OF_ENROLMENT, " + - "LAST_UPDATED_TIMESTAMP, " + + "d.LAST_UPDATED_TIMESTAMP, " + "STATUS, " + "DATE_OF_LAST_UPDATE, " + "TIMESTAMPDIFF(DAY, ?, ?) as DAYS_SINCE_ENROLLED " + @@ -352,12 +352,12 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { try { conn = this.getConnection(); String sql = "select d.ID AS DEVICE_ID, " + - "DEVICE_IDENTIFICATION, " + + "d.DEVICE_IDENTIFICATION, " + "DESCRIPTION, " + "NAME, " + "DATE_OF_ENROLMENT, " + "DATE_OF_LAST_UPDATE, " + - "LAST_UPDATED_TIMESTAMP, " + + "d.LAST_UPDATED_TIMESTAMP, " + "STATUS, " + "TIMESTAMPDIFF(DAY, DATE_OF_LAST_UPDATE, ?) AS DAYS_USED " + "from DM_DEVICE d, DM_ENROLMENT e " + @@ -400,9 +400,9 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl { conn = this.getConnection(); String sql = "SELECT " + "DM_DEVICE.ID AS DEVICE_ID, " + - "DEVICE_IDENTIFICATION, " + + "d.DEVICE_IDENTIFICATION, " + "DESCRIPTION, " + - "LAST_UPDATED_TIMESTAMP, " + + "d.LAST_UPDATED_TIMESTAMP, " + "DM_DEVICE.NAME AS DEVICE_NAME, " + "DEVICE_TYPE, " + "DM_ENROLMENT.ID AS ENROLMENT_ID, " + 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 851153de16..918ffb062c 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 @@ -2233,8 +2233,6 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv String msg = "Error occurred while opening a connection to the data source"; log.info(msg, e); throw new DeviceManagementException(msg, e); - } finally { - DeviceManagementDAOFactory.closeConnection(); } }