79155677

Date: 2024-11-04 13:52:48
Score: 1
Natty:
Report link

The solution was using a native query, which bypasses all of the loading that hibernate does and directly executes the delete command:

@Transactional
    public void delete(Long id) {
        long deleted = repository.delete("id", id);
        if (deleted == 0) {
            throw new NotFoundException("Game not found with id: " + id);
        }
    }
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: momchil milkov