Improved SQL query with DESC sorting

appbr1
Pramila Niroshan 2 months ago
parent a45820e845
commit 20df0c879f

@ -139,7 +139,7 @@ public class GenericCertificateDAOImpl extends AbstractCertificateDAOImpl {
isCertificateUsernameProvided = true; isCertificateUsernameProvided = true;
} }
query += "ORDER BY ID LIMIT ?,?"; query += "ORDER BY ID DESC LIMIT ?,?";
try (PreparedStatement stmt = conn.prepareStatement(query)) { try (PreparedStatement stmt = conn.prepareStatement(query)) {
int paramIdx = 1; int paramIdx = 1;

@ -78,7 +78,7 @@ public class OracleCertificateDAOImpl extends AbstractCertificateDAOImpl {
isCertificateUsernameProvided = true; isCertificateUsernameProvided = true;
} }
query += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; query += "ORDER BY ID DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
try (PreparedStatement stmt = conn.prepareStatement(query)) { try (PreparedStatement stmt = conn.prepareStatement(query)) {
int paramIdx = 1; int paramIdx = 1;

@ -78,7 +78,7 @@ public class PostgreSQLCertificateDAOImpl extends AbstractCertificateDAOImpl {
isCertificateUsernameProvided = true; isCertificateUsernameProvided = true;
} }
query += "ORDER BY ID LIMIT ? OFFSET ?"; query += "ORDER BY ID DESC LIMIT ? OFFSET ?";
try (PreparedStatement stmt = conn.prepareStatement(query)) { try (PreparedStatement stmt = conn.prepareStatement(query)) {
int paramIdx = 1; int paramIdx = 1;

@ -78,7 +78,7 @@ public class SQLServerCertificateDAOImpl extends AbstractCertificateDAOImpl {
isCertificateUsernameProvided = true; isCertificateUsernameProvided = true;
} }
query += "ORDER BY ID OFFSET ? ROWS FETCH NEXT ? ROWS ONLY"; query += "ORDER BY ID DESC OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
try (PreparedStatement stmt = conn.prepareStatement(query)) { try (PreparedStatement stmt = conn.prepareStatement(query)) {
int paramIdx = 1; int paramIdx = 1;

Loading…
Cancel
Save