![](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FcS3k9t%2FbtsFoHU9bQG%2FEYLZXPSwqQWqmpTBzp1BB0%2Fimg.png)
문제점이 있었던 코드 댓글을 저장하는 로직 @Transactional public void create(CommentCreateRequestDto requestDto, User user) { Long postId = requestDto.getPostId(); Post post = findPostByPostId(postId); Comment child = requestDto.toEntity(user, post); requestDto.getCommentIdOptional().ifPresent(commentId -> linkParent(commentId, child)); commentRepository.save(child); post.increaseCommentCount(); } 게시글과 댓글의 관계에서 1개..