diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java index fa49844dc55..97db197a1b2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractDeviceDAOImpl.java @@ -1837,7 +1837,7 @@ public abstract class AbstractDeviceDAOImpl implements DeviceDAO { try (ResultSet rs = ps.executeQuery()) { List devices = new ArrayList<>(); DeviceInfo deviceInfo = new DeviceInfo(); - if (rs.next()) { + while (rs.next()) { Device device = DeviceManagementDAOUtil.loadDevice(rs); deviceInfo.setOsVersion(rs.getString(Constants.OS_VERSION)); deviceInfo.setOsBuildDate(rs.getString(Constants.OS_BUILD_DATE)); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java index 10be14fa1de..033d7c80b99 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/device/OracleDeviceDAOImpl.java @@ -876,7 +876,7 @@ public class OracleDeviceDAOImpl extends AbstractDeviceDAOImpl { try (ResultSet rs = ps.executeQuery()) { List devices = new ArrayList<>(); DeviceInfo deviceInfo = new DeviceInfo(); - if (rs.next()) { + while (rs.next()) { Device device = DeviceManagementDAOUtil.loadDevice(rs); deviceInfo.setOsVersion(rs.getString(Constants.OS_VERSION)); deviceInfo.setOsBuildDate(rs.getString(Constants.OS_BUILD_DATE));