Interface WorkerRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Worker,UUID>, org.springframework.data.jpa.repository.JpaRepository<Worker,UUID>, org.springframework.data.repository.ListCrudRepository<Worker,UUID>, org.springframework.data.repository.ListPagingAndSortingRepository<Worker,UUID>, org.springframework.data.repository.PagingAndSortingRepository<Worker,UUID>, org.springframework.data.repository.query.QueryByExampleExecutor<Worker>, org.springframework.data.repository.Repository<Worker,UUID>

@Repository public interface WorkerRepository extends org.springframework.data.jpa.repository.JpaRepository<Worker,UUID>
Repository for the Worker entity.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Counts the number of workers of the given Office.
    @NotNull Optional<Worker>
    findById(@NotNull UUID id)
    Finds a Worker by its id.
    Finds a Worker by its username.

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

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

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

    findAll, findAllById, saveAll

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

    findAll

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

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findById

      @NotNull @NotNull Optional<Worker> findById(@NotNull @NotNull UUID id)
      Finds a Worker by its id.
      Specified by:
      findById in interface org.springframework.data.repository.CrudRepository<Worker,UUID>
      Parameters:
      id - the id of the Worker to find.
      Returns:
      an Optional containing the Worker if found, an empty Optional otherwise.
    • countByOffice

      long countByOffice(Office office)
      Counts the number of workers of the given Office.
      Parameters:
      office - the Office to count the workers of.
      Returns:
      the number of workers of the given Office.
    • findByUsername

      Optional<Worker> findByUsername(String username)
      Finds a Worker by its username.
      Parameters:
      username - the username of the Worker to find.
      Returns:
      an Optional containing the Worker if found, an empty Optional otherwise.