Open semihshn opened 1 year ago
this instead of you should use CascadeType.REMOVE, in this way if author perma delete then also books of author delete with hibernate automatically
hint: you must write cascade=CascadeType.REMOVE to in @OneToMany annotation
you should do something for 51. row to orElseThrow case and you should not invoke twice to authorRepository.findById also you should use getById method from same class because of clean code, we not want long method name in clean code
Instead of using AUTHOR_MAPPER.convertToAuthorDto(this.authorEntityService.permanentlyDelete(id)), you can write this.authorEntityService.permanentlyDelete(id).convertTo(). Also, you can create a convertTo method inside the Author class like this;
you should use .toList() instead of .collect(Collectors.toList())
You shouldnt use @Autowired