This commit is contained in:
Николай 2023-04-10 22:14:46 +04:00
parent 9ffcbf46b1
commit bfd9a5782a
3 changed files with 3 additions and 3 deletions

Binary file not shown.

View File

@ -18,7 +18,7 @@ public class Reader {
@Column @Column
private String hashedPassword; private String hashedPassword;
@ManyToMany(fetch = FetchType.EAGER) @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.MERGE)
private List<Manga> mangas; private List<Manga> mangas;
public Reader() { public Reader() {

View File

@ -92,9 +92,9 @@ public class MangaService {
public Manga deleteManga(Long id) { public Manga deleteManga(Long id) {
final Manga currentManga = findManga(id); final Manga currentManga = findManga(id);
final List<Reader> listReader = readerService.findAllReaders(); final List<Reader> listReader = readerService.findAllReaders();
for (Reader reader : listReader){ /* for (Reader reader : listReader){
reader.getMangas().remove(currentManga); reader.getMangas().remove(currentManga);
} }*/
mangaRepository.delete(currentManga); mangaRepository.delete(currentManga);
return currentManga; return currentManga;
} }