Ejemplo n.º 1
0
 public List<Comment> getAllComments(int messageId) {
   try {
     ResultSet rs = db.getAllDatas("comment where \"messageId\" = " + messageId);
     while (rs.next()) {
       Comment comment = new Comment();
       comment.setId(rs.getInt("id"));
       comment.setCommentMessage(rs.getString("commentMessage"));
       comment.setAuthor(rs.getString("author"));
       comment.setCreated(rs.getDate("created"));
       comments.add(comment);
     }
   } catch (SQLException e) {
     e.printStackTrace();
   }
   return comments;
 }