Interface CompanyRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Company,Integer>, org.springframework.data.jpa.repository.JpaRepository<Company,Integer>, org.springframework.data.repository.PagingAndSortingRepository<Company,Integer>, org.springframework.data.repository.query.QueryByExampleExecutor<Company>, org.springframework.data.repository.Repository<Company,Integer>

@Repository public interface CompanyRepository extends org.springframework.data.jpa.repository.JpaRepository<Company,Integer>
Spring Data repository used to access the company in BBDD. See Company.
  • Method Summary

    Modifier and Type
    Method
    Description
    Find company by name.
    <S extends Company>
    S
    saveAndFlush(S entity)
    Saves an entity and flushes changes instantly.

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

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

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

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, findAll, findAll, findAllById, flush, getById, getOne, getReferenceById, saveAll, saveAllAndFlush

    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

    • saveAndFlush

      <S extends Company> S saveAndFlush(S entity)
      Saves an entity and flushes changes instantly.
      Specified by:
      saveAndFlush in interface org.springframework.data.jpa.repository.JpaRepository<Company,Integer>
      Type Parameters:
      S - the entity type.
      Parameters:
      entity - the entity to save
      Returns:
      the saved entity
    • findByName

      @Query(nativeQuery=true, value="SELECT c.* FROM company c WHERE c.name = :name") Optional<Company> findByName(@Param("name") String name)
      Find company by name.
      Parameters:
      name - company
      Returns:
      The company