There are two playlist(id, user, title) tables playlist(id, user, title) and playlist_content(id, playlist_id, melody_id) . It is necessary that when deleting a record from the playlist, all records from the playlist_content are deleted, while deleting nothing in the playlist_content table from the playlist (and no errors should appear). I did it like this: I put PlaylistContent cascade = CascadeType.REMOVE on the playlist field
@ManyToOne(cascade = CascadeType.REMOVE) @JoinColumn(name = "playlist_id", nullable = false) private Playlist playlist; Will this work correctly?