Пример #1
0
  private static void insertComments(SessionWrapper sessionWrapper, Post post, int numComments) {
    for (int i = 0; i < numComments; i++) {
      Comment com = new Comment();
      com.setCommenter(getCommenter());
      com.setContent(getString(1, 10));
      com.setId(getTimeUUID());
      com.setPostedOn(System.currentTimeMillis());
      com.setPostId(post.getId());
      com.setTitle(getString(1, 3));
      com.save(sessionWrapper);

      CommentVotes votes = new CommentVotes();
      votes.setCommentId(com.getId());
      votes.setDownvotes(getInt(0, 10));
      votes.setUpvotes(getInt(0, 10));
      votes.save(sessionWrapper);
    }
  }