We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f6031f1 commit 29fb202Copy full SHA for 29fb202
src/main/java/com/example/postgresdemo/model/Answer.java
@@ -1,6 +1,9 @@
1
package com.example.postgresdemo.model;
2
3
import com.fasterxml.jackson.annotation.JsonIgnore;
4
+import org.hibernate.annotations.OnDelete;
5
+import org.hibernate.annotations.OnDeleteAction;
6
+
7
import javax.persistence.*;
8
9
@Entity
@@ -20,6 +23,7 @@ public class Answer extends AuditModel {
20
23
21
24
@ManyToOne(fetch = FetchType.LAZY)
22
25
@JoinColumn(name = "question_id", nullable = false)
26
+ @OnDelete(action = OnDeleteAction.CASCADE)
27
@JsonIgnore
28
private Question question;
29
0 commit comments