From c8218087971a25ddb5e10b6332ff45ae77ec8d06 Mon Sep 17 00:00:00 2001 From: Shamalka Navod Date: Mon, 9 Nov 2020 19:29:15 +0000 Subject: [PATCH] Fix store app loading issue --- .../dao/impl/application/GenericApplicationDAOImpl.java | 6 +++--- .../dao/impl/application/OracleApplicationDAOImpl.java | 7 +++---- .../dao/impl/application/SQLServerApplicationDAOImpl.java | 7 +++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java index 1059fe4580..845c4626d5 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/GenericApplicationDAOImpl.java @@ -173,14 +173,14 @@ public class GenericApplicationDAOImpl extends AbstractDAOImpl implements Applic if (deviceTypeId != -1) { sql += "AND AP_APP.DEVICE_TYPE_ID = ? "; } - sql += "GROUP BY AP_APP.ID "; + sql += "GROUP BY AP_APP.ID ORDER BY AP_APP.ID "; if (StringUtils.isNotEmpty(filter.getSortBy())) { - sql += "ORDER BY ID " + filter.getSortBy() +" "; + sql += filter.getSortBy() +" "; } if (filter.getLimit() != -1) { sql += "LIMIT ? OFFSET ? "; } - sql += ") AS app_data ON app_data.ID = AP_APP.ID WHERE AP_APP.TENANT_ID = ?"; + sql += ") AS app_data ON app_data.ID = AP_APP.ID WHERE AP_APP.TENANT_ID = ? ORDER BY AP_APP.ID"; try { Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/OracleApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/OracleApplicationDAOImpl.java index b570c10fab..c57ef8a07d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/OracleApplicationDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/OracleApplicationDAOImpl.java @@ -118,15 +118,14 @@ public class OracleApplicationDAOImpl extends GenericApplicationDAOImpl { if (deviceTypeId != -1) { sql += "AND AP_APP.DEVICE_TYPE_ID = ? "; } - sql += "GROUP BY AP_APP.ID "; + sql += "GROUP BY AP_APP.ID ORDER BY AP_APP.ID "; if (StringUtils.isNotEmpty(filter.getSortBy())) { - sql += "ORDER BY ID " + filter.getSortBy() + " "; + sql += filter.getSortBy() +" "; } if (filter.getLimit() != -1) { sql += "OFFSET ? ROWS FETCH NEXT ? ROWS ONLY "; } - sql += ") AS app_data ON app_data.ID = AP_APP.ID " + - "WHERE AP_APP.TENANT_ID = ?"; + sql += ") AS app_data ON app_data.ID = AP_APP.ID WHERE AP_APP.TENANT_ID = ? ORDER BY AP_APP.ID"; try { Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java index 8825b20579..ee7c78f8ba 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/SQLServerApplicationDAOImpl.java @@ -117,15 +117,14 @@ public class SQLServerApplicationDAOImpl extends GenericApplicationDAOImpl { if (deviceTypeId != -1) { sql += "AND AP_APP.DEVICE_TYPE_ID = ? "; } - sql += "GROUP BY AP_APP.ID "; + sql += "GROUP BY AP_APP.ID ORDER BY AP_APP.ID "; if (StringUtils.isNotEmpty(filter.getSortBy())) { - sql += "ORDER BY ID " + filter.getSortBy() + " "; + sql += filter.getSortBy() +" "; } if (filter.getLimit() != -1) { sql += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY "; } - sql += ") AS app_data ON app_data.ID = AP_APP.ID " + - "WHERE AP_APP.TENANT_ID = ?"; + sql += ") AS app_data ON app_data.ID = AP_APP.ID WHERE AP_APP.TENANT_ID = ? ORDER BY AP_APP.ID"; try { Connection conn = this.getDBConnection(); try (PreparedStatement stmt = conn.prepareStatement(sql)) {