Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#443 [feat] clearAutomatically 추가 #445

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public interface CommentRepository extends JpaRepository<Comment, Long> {

List<Comment> findByPostId(final Long postId);

@Modifying
@Modifying(clearAutomatically = true)
@Query("delete from Comment c where c.post = :post")
void deleteAllByPost(@Param("post")final Post post);

@Modifying
@Modifying(clearAutomatically = true)
@Query("DELETE FROM Comment c where c.writerName = :writerName")
void deleteAllByWriterName(@Param("writerName") final WriterName writerName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ public interface CommentReplyRepository extends JpaRepository<CommentReply, Long

int countByWriterNameId(final Long writerNameId);

@Modifying
@Modifying(clearAutomatically = true)
@Query("DELETE FROM CommentReply c WHERE c.comment = :comment")
void deleteCommentRepliesByComment(final Comment comment);

@Modifying
@Modifying(clearAutomatically = true)
@Query("DELETE FROM CommentReply c WHERE c.writerName = :writerName")
void deleteCommentRepliesByWriterName(@Param("writerName") final WriterName writerName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ public interface PostRepository extends JpaRepository<Post, Long>, PostRepositor

List<Post> findByTopic(final Topic topic);

List<Post> findByWriterNameId(final Long writerNameId);

int countByWriterNameId(final Long writerNameId);


@Modifying
@Modifying(clearAutomatically = true)
@Query("DELETE FROM Post p WHERE p.topic = :topic")
void deleteByTopic(@Param("topic") Topic topic);


@Modifying
@Modifying(clearAutomatically = true)
@Query("DELETE FROM Post p WHERE p.writerName = :writerName")
void deleteByWriterName(@Param("writerName") WriterName writerName);
}
Loading