Interface NotFoundRepository<T,I>

All Superinterfaces:
org.springframework.data.repository.CrudRepository<T,I>, org.springframework.data.repository.Repository<T,I>
All Known Subinterfaces:
ProjectRepository, SoftDeleteRepository<T,I>

@NoRepositoryBean public interface NotFoundRepository<T,I> extends org.springframework.data.repository.CrudRepository<T,I>
Interface for automatic throwing not found status code exception when object with given id was not found.
  • Method Summary

    Modifier and Type
    Method
    Description
    default T
    Retrieves an entity by its id.

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAll, findAllById, findById, save, saveAll
  • Method Details

    • findByIdOrThrow

      default T findByIdOrThrow(I id)
      Retrieves an entity by its id.
      Parameters:
      id - must not be null
      Returns:
      the entity with the given id.
      Throws:
      IllegalArgumentException - if id is null.
      org.springframework.web.server.ResponseStatusException - if entity with given id is not found.