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."); }