From a03a1e67313da115aafef21f9a2137f8e13f0fe5 Mon Sep 17 00:00:00 2001 From: Thanh Lee Date: Fri, 13 Dec 2024 21:52:55 +0000 Subject: [PATCH] sort for all other find functions --- src/main/java/cloudgene/mapred/database/JobDao.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/cloudgene/mapred/database/JobDao.java b/src/main/java/cloudgene/mapred/database/JobDao.java index 14e8769a..5af0b3eb 100644 --- a/src/main/java/cloudgene/mapred/database/JobDao.java +++ b/src/main/java/cloudgene/mapred/database/JobDao.java @@ -153,7 +153,7 @@ public List findAllByUser(User user) { sql.append("select * "); sql.append("from job "); sql.append("where user_id = ? and state != ? "); - sql.append("order by id desc "); + sql.append("order by submitted_on desc "); Object[] params = new Object[2]; params[0] = user.getId(); @@ -260,7 +260,7 @@ public List findAllNotRetiredJobs() { sql.append("from job "); sql.append("join `user` on job.user_id = `user`.id "); sql.append("where state not in (?,?,?,?,?,?,?) "); - sql.append("order by job.id desc "); + sql.append("order by job.submitted_on desc "); List result = new Vector(); @@ -294,7 +294,7 @@ public List findAllNotNotifiedJobs() { sql.append("from job "); sql.append("join `user` on job.user_id = `user`.id "); sql.append("where state != ? AND state != ? AND state != ? AND state != ? "); - sql.append("order by job.id desc "); + sql.append("order by job.submitted_on desc "); List result = new Vector(); @@ -325,7 +325,7 @@ public List findAllNotifiedJobs() { sql.append("from job "); sql.append("join `user` on job.user_id = `user`.id "); sql.append("where state = ? or state = ? "); - sql.append("order by job.id desc "); + sql.append("order by job.submitted_on desc "); Object[] params = new Object[2]; params[0] = AbstractJob.STATE_SUCESS_AND_NOTIFICATION_SEND; @@ -354,7 +354,7 @@ public List findAllOlderThan(long time, int state) { sql.append("from job "); sql.append("join `user` on job.user_id = `user`.id "); sql.append("where state = ? AND finished_on != 0 AND finished_on < ? "); - sql.append("order by job.id desc "); + sql.append("order by job.submitted_on desc "); Object[] params = new Object[2]; params[0] = state; @@ -383,7 +383,7 @@ public List findAllByState(int state) { sql.append("from job "); sql.append("join `user` on job.user_id = `user`.id "); sql.append("where state = ? "); - sql.append("order by job.id desc "); + sql.append("order by job.submitted_on desc "); Object[] params = new Object[1]; params[0] = state;