Dafür habe ich Kommentare mit untergeordneten Kommentaren erstellt.
Aber jedes Mal, wenn ich einen Kommentar löschen möchte, eskaliert der Ruhezustand und versucht, einfach ALLES zu laden.
Das ist meine Kommentar-Entität:
Code: Select all
@Entity
@Setter
@Getter
public class Comment extends AuditedEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
//--Hierarchy for CommentToTicket--
@ManyToOne
private Ticket ticket;
//--Hierarchy for Comments--
@OneToMany(mappedBy = "parentComment", cascade = CascadeType.ALL, orphanRemoval = true)
@OrderBy("createdDate ASC")
private List comments = new ArrayList();
@ManyToOne
private Comment parentComment;
private String commentText; //TODO: pictures? (blob maybe)
private int likes;
private int dislikes;
}
Code: Select all
@Transactional
public void deleteComment(Long id) {
commentRepository.deleteById(id);
}
Kann mir jemand helfen? Vielen Dank
WICHTIG
Für mein Projekt ist mir Lazyload nicht gestattet. Ich weiß, dass dies dieses Problem beheben würde. Gibt es eine andere Lösung?
Und bitte entschuldigen Sie. Ich bin ein Anfänger.
Mobile version