Code example for ResultSet

Methods: getDate, getLong, getString

0
 
    public class CommentRowMapper implements ParameterizedRowMapper<Comment> {
        public Comment mapRow(ResultSet rs, int rowNum)
            throws SQLException { 
            Comment comment = new Comment();
            comment.setCommentID(rs.getLong("COMMENT_ID"));
            comment.setCommentContent(rs.getString("COMMENT_CONTENT"));
            comment.setCommentDate(rs.getDate("COMMENT_DATE"));
            comment.setCommentUserEmail(rs.getString("COMMENT_USER_EMAIL"));
            comment.setCommentUserName(rs.getString("COMMENT_USER_NAME"));
 
            return comment;
        } 
    } 
     
     
}