From 23f06ffa5f47e63360bbeb2621a731909716a460 Mon Sep 17 00:00:00 2001 From: windeer9 Date: Wed, 24 Jan 2024 16:38:27 +0900 Subject: [PATCH] refact: delete table change --- .../com/green/greenearthforus/calendar/entity/Calendar.java | 2 +- .../com/green/greenearthforus/comment/entity/Comment.java | 4 ++-- .../main/java/com/green/greenearthforus/vote/entity/Vote.java | 2 +- .../java/com/green/greenearthforus/vote/entity/VoteUser.java | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/server/src/main/java/com/green/greenearthforus/calendar/entity/Calendar.java b/server/src/main/java/com/green/greenearthforus/calendar/entity/Calendar.java index f5603582..069f940e 100644 --- a/server/src/main/java/com/green/greenearthforus/calendar/entity/Calendar.java +++ b/server/src/main/java/com/green/greenearthforus/calendar/entity/Calendar.java @@ -29,7 +29,7 @@ public class Calendar { @ElementCollection private List stampedDates; - @OneToOne + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JoinColumn(name = "user_id") private User user; diff --git a/server/src/main/java/com/green/greenearthforus/comment/entity/Comment.java b/server/src/main/java/com/green/greenearthforus/comment/entity/Comment.java index 0c1bb43a..50d28ac4 100644 --- a/server/src/main/java/com/green/greenearthforus/comment/entity/Comment.java +++ b/server/src/main/java/com/green/greenearthforus/comment/entity/Comment.java @@ -27,11 +27,11 @@ public class Comment { @Column(name = "created_at") private LocalDateTime createdAt; - @ManyToOne(fetch = FetchType.LAZY) + @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL) @JoinColumn(name = "user_id") private User user; - @ManyToOne + @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "post_id") private Post post; } diff --git a/server/src/main/java/com/green/greenearthforus/vote/entity/Vote.java b/server/src/main/java/com/green/greenearthforus/vote/entity/Vote.java index 87bdcb60..a61be0e8 100644 --- a/server/src/main/java/com/green/greenearthforus/vote/entity/Vote.java +++ b/server/src/main/java/com/green/greenearthforus/vote/entity/Vote.java @@ -22,7 +22,7 @@ public class Vote { @Column private String voteType; - @OneToOne + @OneToOne(cascade = CascadeType.ALL, orphanRemoval = true) @JoinColumn(name = "post_id") private Post post; diff --git a/server/src/main/java/com/green/greenearthforus/vote/entity/VoteUser.java b/server/src/main/java/com/green/greenearthforus/vote/entity/VoteUser.java index 01f2a8e3..cef76104 100644 --- a/server/src/main/java/com/green/greenearthforus/vote/entity/VoteUser.java +++ b/server/src/main/java/com/green/greenearthforus/vote/entity/VoteUser.java @@ -15,11 +15,11 @@ public class VoteUser { @GeneratedValue(strategy = GenerationType.IDENTITY) private long voteUserId; - @ManyToOne + @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "user_id") private User user; - @ManyToOne + @ManyToOne(cascade = CascadeType.ALL) @JoinColumn(name = "vote_id") private Vote vote;