I have this repository:
public interface CheckListRepository extends BaseRepository<CheckList, Long>, JpaSpecificationExecutor<CheckList> {
void deleteAllByIdIn(List<Long> ids);
}
And entity Checklist where I have relation between columns
@OneToMany(mappedBy = "checkList", cascade = CascadeType.REMOVE, orphanRemoval = true)
private List<Category> categories;
I was trying to delete some checklists by their ids in method
@Transactional
public Response deleteAllCheckLists(BatchChecklistDeleteRequest request) {
Project currentProject = projectRepository.findByIdOrThrowException(request.getProjectId());
entityAccessCheck.checkCurrentAccountAccess(currentProject);
checkListRepository.deleteAllByIdIn(request.getChecklistIds());
log.info("Deleted checklists with IDs: {}", request.getChecklistIds());
return new Response<>().deleteAll();
}
Objects in the database are not deleted
But the request is not even created, I understand that it’s about the reference key, but why does everything work as it should with a single deletion request, via a regular deleteById?
An entity without any connections is deleted normally