From 5cd63c1c884a4e42e4cdb57e8d52f7753c1cf667 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Fri, 22 May 2015 13:07:14 +0530 Subject: [PATCH] Fixing policy count --- .../wso2/carbon/policy/mgt/core/dao/impl/PolicyDAOImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 7e040700637..09626d9c3dd 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 @@ -1352,12 +1352,12 @@ public class PolicyDAOImpl implements PolicyDAO { int policyCount = 0; try { conn = this.getConnection(); - String query = "SELECT COUNT(DM_POLICY.ID) FROM DM_POLICY"; + String query = "SELECT COUNT(ID) AS POLICY_COUNT FROM DM_POLICY"; stmt = conn.prepareStatement(query); resultSet = stmt.executeQuery(); while (resultSet.next()) { - policyCount = resultSet.getInt(0); + policyCount = resultSet.getInt("POLICY_COUNT"); } return policyCount;