Skip to content
Snippets Groups Projects
Commit 16e668b8 authored by Florine Lefebvre's avatar Florine Lefebvre :stuck_out_tongue_closed_eyes:
Browse files

affichage des threads dans l'ordre antéchrnologique

parent accfa00a
Branches
No related tags found
No related merge requests found
package modele.dao;
import java.util.List;
public interface Dao<E>{
List<E> findAll();
void create(E elt);
void update(E elt);
void delete(E elt);
}
......@@ -92,7 +92,7 @@ public class DaoThread {
DS bdd = DS.getInstance();
List<Thread> res = new ArrayList<>();
try(Connection con = bdd.getConnection()) {
PreparedStatement ps = con.prepareStatement("SELECT * FROM threads WHERE id_thread NOT IN (SELECT id_thread FROM followers WHERE username = ?)");
PreparedStatement ps = con.prepareStatement("SELECT * FROM threads WHERE id_thread NOT IN (SELECT id_thread FROM followers WHERE username = ?) ORDER BY date DESC");
ps.setString(1, creator);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
......@@ -108,7 +108,7 @@ public class DaoThread {
DS bdd = DS.getInstance();
List<Thread> res = new ArrayList<>();
try(Connection con = bdd.getConnection()) {
PreparedStatement ps = con.prepareStatement("SELECT * FROM threads WHERE id_thread IN (SELECT id_thread FROM followers WHERE username = ?)");
PreparedStatement ps = con.prepareStatement("SELECT * FROM threads WHERE id_thread IN (SELECT id_thread FROM followers WHERE username = ?) ORDER BY date DESC");
ps.setString(1, creator);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment