feat: on delete 설정

This commit is contained in:
박정민 2024-08-09 15:17:28 +09:00
parent 3027afd059
commit f628bbbd00
3 changed files with 13 additions and 7 deletions

View File

@ -4,6 +4,8 @@ import com.edufocus.edufocus.lecture.entity.Lecture;
import com.edufocus.edufocus.user.model.entity.vo.User;
import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import java.util.Date;
@ -13,6 +15,8 @@ import java.util.Date;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@OnDelete(action = OnDeleteAction.CASCADE)
public class Qna {
// 연관관계 주인

View File

@ -7,6 +7,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.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
@ -22,6 +24,7 @@ import java.util.List;
@Builder
@EntityListeners(AuditingEntityListener.class)
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
@OnDelete(action = OnDeleteAction.CASCADE)
public class Report {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)

View File

@ -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;
@ -19,7 +18,6 @@ import java.util.List;
import java.util.UUID;
@Entity
@Getter
@Builder
@ -27,6 +25,7 @@ import java.util.UUID;
@AllArgsConstructor
@EntityListeners(AuditingEntityListener.class)
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY)
@OnDelete(action = OnDeleteAction.CASCADE)
public class ReportSet {
@Id
@GeneratedValue(generator = "UUID")