From bf81f36fa67b5362744b9909682e360dcc916ef8 Mon Sep 17 00:00:00 2001 From: Pahansith Date: Tue, 24 Aug 2021 13:06:37 +0530 Subject: [PATCH] Fix error while adding app install to a device group (cherry picked from commit d8999cd3a6a23c82bc08b2dea3b71019a1cc02c9) --- .../carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java index faf136bb7c..7584b5fea7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java @@ -1115,7 +1115,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO { + "FROM DM_DEVICE d, " + "(SELECT dgm.DEVICE_ID " + "FROM DM_DEVICE_GROUP_MAP dgm " - + "WHERE dgm.GROUP_ID = (SELECT ID FROM DM_GROUP WHERE GROUP_NAME = ? )) dgm1 " + + "WHERE dgm.GROUP_ID = (SELECT ID FROM DM_GROUP WHERE GROUP_NAME = ? AND TENANT_ID = ?)) dgm1 " + "WHERE d.ID = dgm1.DEVICE_ID AND d.TENANT_ID = ?) gd, DM_DEVICE_TYPE t " + "WHERE gd.DEVICE_TYPE_ID = t.ID) d1 " + "WHERE d1.DEVICE_ID = e.DEVICE_ID AND TENANT_ID = ? AND e.STATUS IN (", @@ -1129,6 +1129,7 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO { stmt.setString(index++, groupName); stmt.setInt(index++, tenantId); stmt.setInt(index++, tenantId); + stmt.setInt(index++, tenantId); for (String deviceId : deviceStatuses) { stmt.setObject(index++, deviceId); }