From 4cd2b9430382665841a207ef449a6cc74acd005f Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Thu, 22 Dec 2016 10:58:54 +0530 Subject: [PATCH] IOTS-325: Fixing cannot delete a policy associated with a group --- .../wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java index 7b6da5a882e..700768fb0a0 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java @@ -1361,6 +1361,11 @@ public class PolicyDAOImpl implements PolicyDAO { stmt.setInt(1, policyId); stmt.executeUpdate(); + String deleteGroup = "DELETE FROM DM_DEVICE_GROUP_POLICY WHERE POLICY_ID = ?"; + stmt = conn.prepareStatement(deleteGroup); + stmt.setInt(1, policyId); + stmt.executeUpdate(); + if (log.isDebugEnabled()) { log.debug("Policy (" + policyId + ") related configs deleted from database."); }