diff --git a/data.mv.db b/data.mv.db index 8a91d72..322a014 100644 Binary files a/data.mv.db and b/data.mv.db differ diff --git a/src/main/java/com/LabWork/app/MangaStore/model/Default/Reader.java b/src/main/java/com/LabWork/app/MangaStore/model/Default/Reader.java index 2e10a77..bd216ab 100644 --- a/src/main/java/com/LabWork/app/MangaStore/model/Default/Reader.java +++ b/src/main/java/com/LabWork/app/MangaStore/model/Default/Reader.java @@ -18,7 +18,7 @@ public class Reader { @Column private String hashedPassword; - @ManyToMany(fetch = FetchType.EAGER) + @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.MERGE) private List mangas; public Reader() { diff --git a/src/main/java/com/LabWork/app/MangaStore/service/MangaService.java b/src/main/java/com/LabWork/app/MangaStore/service/MangaService.java index dd4a4de..96c1576 100644 --- a/src/main/java/com/LabWork/app/MangaStore/service/MangaService.java +++ b/src/main/java/com/LabWork/app/MangaStore/service/MangaService.java @@ -92,9 +92,9 @@ public class MangaService { public Manga deleteManga(Long id) { final Manga currentManga = findManga(id); final List listReader = readerService.findAllReaders(); - for (Reader reader : listReader){ +/* for (Reader reader : listReader){ reader.getMangas().remove(currentManga); - } + }*/ mangaRepository.delete(currentManga); return currentManga; }