From 986828bc16a6f0a49d9f56f51643839437a9c12a Mon Sep 17 00:00:00 2001 From: Mohamed Rashd Date: Wed, 2 Mar 2022 19:22:47 +0530 Subject: [PATCH] Fix application count query not containing AP_APP_RELEASE columns when filtering Fix inaccurate application count when an appliction has more than 1 release --- .../core/dao/impl/application/GenericApplicationDAOImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java index 1bcdae86a9..05279c29ef 100644 --- a/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java +++ b/components/application-mgt/io.entgra.application.mgt.core/src/main/java/io/entgra/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java @@ -260,8 +260,11 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic Connection conn; PreparedStatement stmt = null; ResultSet rs = null; - String sql = "SELECT count(AP_APP.ID) AS APP_COUNT " + String sql = "SELECT count(DISTINCT AP_APP.ID) AS APP_COUNT " + "FROM AP_APP " + + "LEFT JOIN AP_APP_RELEASE ON " + + "AP_APP.ID = AP_APP_RELEASE.AP_APP_ID " + + "INNER JOIN (SELECT ID FROM AP_APP) AS app_data ON app_data.ID = AP_APP.ID " + "WHERE AP_APP.TENANT_ID = ?"; if (filter == null) {