fix(api): clear EntityManager before deleting books (#1467)
This commit is contained in:
@@ -462,13 +462,13 @@ public class BookService {
|
||||
}
|
||||
}
|
||||
|
||||
bookRepository.deleteAllInBatch(books);
|
||||
|
||||
// Because this is `InBatch` we need to clear and flush the entity manager to
|
||||
// prevent unexpected updates of records when the transaction commits.
|
||||
entityManager.flush();
|
||||
entityManager.clear();
|
||||
|
||||
bookRepository.deleteAllInBatch(books);
|
||||
|
||||
auditService.log(AuditAction.BOOK_DELETED, "Deleted " + ids.size() + " book(s)");
|
||||
BookDeletionResponse response = new BookDeletionResponse(ids, failedFileDeletions);
|
||||
return failedFileDeletions.isEmpty()
|
||||
|
||||
Reference in New Issue
Block a user