Skip to content
Snippets Groups Projects
Commit 6d1d3f60 authored by Yannis Devos's avatar Yannis Devos
Browse files

Correction probleme d'import avec Thread

parent 181ea2d3
Branches master
No related tags found
No related merge requests found
File deleted
File deleted
File deleted
File deleted
File deleted
File deleted
...@@ -2,6 +2,7 @@ package dao; ...@@ -2,6 +2,7 @@ package dao;
import dto.Message; import dto.Message;
import dto.User; import dto.User;
import dto.MyThread;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -35,15 +36,15 @@ public class ThreadDAO { ...@@ -35,15 +36,15 @@ public class ThreadDAO {
return messages; return messages;
} }
public Thread getThreadById(int threadID) throws SQLException { public MyThread getThreadById(int threadID) throws SQLException {
Thread thread = new Thread(); MyThread thread = new MyThread(0, null);
PreparedStatement ps = this.con.prepareStatement("SELECT threadID, threadName FROM thread WHERE threadID = ?"); PreparedStatement ps = this.con.prepareStatement("SELECT threadID, threadName FROM thread WHERE threadID = ?");
try { try {
ps.setInt(1, threadID); ps.setInt(1, threadID);
ResultSet rs = ps.executeQuery(); ResultSet rs = ps.executeQuery();
if(rs.next()){ if(rs.next()){
thread.setThreadID(rs.getInt(1)); thread.setThreadID(rs.getInt(1));
thread.setName(rs.getString(2)); thread.setThreadName(rs.getString(2));
} }
} }
catch (SQLException sqle) { catch (SQLException sqle) {
......
package dto; package dto;
public class Thread { public class MyThread {
private int threadID; private int threadID;
private String threadName; private String threadName;
// Constructor // // Constructor //
public Thread(int id, String name){ public MyThread(int id, String name){
this.threadID = id; this.threadID = id;
this.threadName = name; this.threadName = name;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment