Remove duplicates in getApplications API

4.x.x
Shamalka Navod 5 years ago committed by Dharmakeerthi Lasantha
parent 65189c5b04
commit 739ee8281f

@ -277,9 +277,9 @@ public class ApplicationDAOImpl implements ApplicationDAO {
throws DeviceManagementDAOException { throws DeviceManagementDAOException {
List<Application> applications = new ArrayList<>(); List<Application> applications = new ArrayList<>();
Application application; Application application;
String sql = "Select " + String sql = "SELECT " +
"ID," + "ID, " +
" NAME, " + "NAME, " +
"APP_IDENTIFIER, " + "APP_IDENTIFIER, " +
"PLATFORM, " + "PLATFORM, " +
"CATEGORY, " + "CATEGORY, " +
@ -291,8 +291,14 @@ public class ApplicationDAOImpl implements ApplicationDAO {
"MEMORY_USAGE, " + "MEMORY_USAGE, " +
"IS_ACTIVE, " + "IS_ACTIVE, " +
"TENANT_ID " + "TENANT_ID " +
"From DM_APPLICATION " + "FROM DM_APPLICATION " +
"WHERE PLATFORM = ? " + "WHERE NOT EXISTS " +
"(SELECT " +
"ID " +
"FROM DM_APPLICATION A " +
"WHERE A.NAME = DM_APPLICATION.NAME " +
"AND A.ID < DM_APPLICATION.ID) " +
"AND PLATFORM = ? " +
"AND TENANT_ID = ? LIMIT ? OFFSET ?"; "AND TENANT_ID = ? LIMIT ? OFFSET ?";
try { try {
Connection conn = this.getConnection(); Connection conn = this.getConnection();

Loading…
Cancel
Save