diff --git a/src/main/java/modernfarmer/server/farmuscommunity/community/entity/Comment.java b/src/main/java/modernfarmer/server/farmuscommunity/community/entity/Comment.java index dfc3e7b..0947a59 100644 --- a/src/main/java/modernfarmer/server/farmuscommunity/community/entity/Comment.java +++ b/src/main/java/modernfarmer/server/farmuscommunity/community/entity/Comment.java @@ -24,9 +24,9 @@ public class Comment extends BaseEntity{ @Column(name = "comment_contents", nullable = false, length = 500) private String commentContents; - @ManyToOne(fetch = FetchType.LAZY, optional = false) - @OnDelete(action = OnDeleteAction.CASCADE) + @ManyToOne(fetch = FetchType.LAZY, optional = false, cascade = CascadeType.REMOVE) @JoinColumn(name = "posting_id", nullable = false) private Posting posting; -} \ No newline at end of file +} + diff --git a/src/main/java/modernfarmer/server/farmuscommunity/community/entity/PostingImage.java b/src/main/java/modernfarmer/server/farmuscommunity/community/entity/PostingImage.java index 188b4ce..7856811 100644 --- a/src/main/java/modernfarmer/server/farmuscommunity/community/entity/PostingImage.java +++ b/src/main/java/modernfarmer/server/farmuscommunity/community/entity/PostingImage.java @@ -21,8 +21,7 @@ public class PostingImage extends BaseEntity{ @Column(name = "image_url", nullable = false, length = 500) private String imageUrl; - @ManyToOne(fetch = FetchType.LAZY, optional = false) - @OnDelete(action = OnDeleteAction.CASCADE) + @ManyToOne(fetch = FetchType.LAZY, optional = false, cascade = CascadeType.REMOVE) @JoinColumn(name = "posting_id", nullable = false) private Posting posting; diff --git a/src/main/java/modernfarmer/server/farmuscommunity/community/entity/PostingReport.java b/src/main/java/modernfarmer/server/farmuscommunity/community/entity/PostingReport.java index b021a6b..9af5927 100644 --- a/src/main/java/modernfarmer/server/farmuscommunity/community/entity/PostingReport.java +++ b/src/main/java/modernfarmer/server/farmuscommunity/community/entity/PostingReport.java @@ -29,8 +29,7 @@ public class PostingReport extends BaseEntity{ private String reportReason; @NotNull - @ManyToOne(fetch = FetchType.LAZY, optional = false) - @OnDelete(action = OnDeleteAction.CASCADE) + @ManyToOne(fetch = FetchType.LAZY, optional = false, cascade = CascadeType.REMOVE) @JoinColumn(name = "posting_id", nullable = false) private Posting posting;