diff --git a/src/main/java/com/example/holing/bounded_context/medicine/entity/Medicine.java b/src/main/java/com/example/holing/bounded_context/medicine/entity/Medicine.java index 2fa3ed8..c454f8d 100644 --- a/src/main/java/com/example/holing/bounded_context/medicine/entity/Medicine.java +++ b/src/main/java/com/example/holing/bounded_context/medicine/entity/Medicine.java @@ -1,6 +1,7 @@ package com.example.holing.bounded_context.medicine.entity; import com.example.holing.bounded_context.user.entity.User; +import jakarta.persistence.CascadeType; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.FetchType; @@ -37,7 +38,7 @@ public class Medicine { @JoinColumn(name = "user_id", nullable = false) private User user; - @OneToMany(fetch = FetchType.LAZY, mappedBy = "medicine") + @OneToMany(fetch = FetchType.LAZY, mappedBy = "medicine", cascade = CascadeType.REMOVE) private List medicineHistoryList = new ArrayList<>(); @Builder