@ -181,6 +181,8 @@ public class GenericDeviceDAOImpl extends AbstractDeviceDAOImpl {
sql += " GROUP BY e.ID ";
}
sql += ") ";
sql += " ORDER BY d1.LAST_UPDATED_TIMESTAMP DESC "; // <-- New order clause
sql += " LIMIT ? OFFSET ?";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {