diff --git a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java index f7ee473..2cca933 100644 --- a/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java +++ b/backend/src/main/java/com/edufocus/edufocus/board/entity/vo/Board.java @@ -9,6 +9,8 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import jakarta.persistence.*; import lombok.*; import org.hibernate.annotations.CreationTimestamp; +import org.hibernate.annotations.OnDelete; +import org.hibernate.annotations.OnDeleteAction; import org.hibernate.annotations.UpdateTimestamp; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedDate; @@ -59,9 +61,9 @@ public class Board { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "lecture_id") + @OnDelete(action = OnDeleteAction.CASCADE) private Lecture lecture; - @OneToMany(mappedBy = "board", cascade = CascadeType.ALL) private List comments; diff --git a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java index fb293ec..ab10529 100644 --- a/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java +++ b/backend/src/main/java/com/edufocus/edufocus/report/entity/vo/ReportSet.java @@ -5,10 +5,9 @@ import com.edufocus.edufocus.quiz.entity.QuizSet; import com.edufocus.edufocus.report.entity.dto.ReportSetResponse; import com.fasterxml.jackson.annotation.JsonAutoDetect; import jakarta.persistence.*; +import jakarta.persistence.CascadeType; import lombok.*; -import org.hibernate.annotations.ColumnDefault; -import org.hibernate.annotations.CreationTimestamp; -import org.hibernate.annotations.GenericGenerator; +import org.hibernate.annotations.*; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.jpa.domain.support.AuditingEntityListener; @@ -46,6 +45,7 @@ public class ReportSet { @ManyToOne @JoinColumn(name = "lecture_id") + @OnDelete(action = OnDeleteAction.CASCADE) private Lecture lecture; @ManyToOne