diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java index 40f9346338a..f08e4a38990 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/search/mgt/impl/ProcessorImpl.java @@ -376,9 +376,8 @@ public class ProcessorImpl implements Processor { } else { query += "?) ORDER BY DEVICE_ID"; stmt = conn.prepareStatement(query); - for (int i = 0; i < devices.size(); i++) { - stmt.setInt(i, devices.get(i).getId()); - } + Array array = conn.createArrayOf("INT", Utils.getArrayOfDeviceIds(devices)); + stmt.setArray(1, array); } rs = stmt.executeQuery();