Reputation: 1208
Is there any specific reason why deleteById(id) will throw an EmptyResultDataAccessException if it does not find the record and deleteByIdAndXXX will not return any exception if the record does not exist ?
Is there any alternative way deleteByIdAndXXX could throw an EmptyResultDataAccessException if the record is not found ?
Jonathan.
Upvotes: 0
Views: 121
Reputation: 16131
deleteById(id)
throws an EmptyResultDataAccessException
when the entity by id is not found because it is implemented that way. Internally deleteById
does a findById
and then deletes the fetched entity or throws that exception.
If you want the same behaviour in your delete method you need to implement it manually.
Upvotes: 1