From 9c7ebdafdb7dc0b12f4ea8e286a36bd7d881a15e Mon Sep 17 00:00:00 2001 From: pasinduj Date: Thu, 3 Dec 2015 18:30:45 +0530 Subject: [PATCH] modified PolicyDAOImpl to fix PolicyRemove error occured by a database Foriegn Key Reference --- .../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 7fd9d04d75..f78feca333 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 @@ -1282,6 +1282,11 @@ public class PolicyDAOImpl implements PolicyDAO { stmt.setInt(1, policyId); stmt.executeUpdate(); + String deleteComplianceStatus ="DELETE FROM DM_POLICY_COMPLIANCE_STATUS WHERE POLICY_ID =?"; + stmt = conn.prepareStatement(deleteComplianceStatus); + stmt.setInt(1, policyId); + stmt.executeUpdate(); + if (log.isDebugEnabled()) { log.debug("Policy (" + policyId + ") related configs deleted from database."); }