Interface CategoryRepository

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

@Repository public interface CategoryRepository extends org.springframework.data.jpa.repository.JpaRepository<Category,Long>
Spring Data JPA repository for Category entities. Provides standard CRUD operations and lookup methods by name.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks whether a category with the given name already exists.
    Finds a category by its unique name.

    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, 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

    • findByName

      Optional<Category> findByName(String name)
      Finds a category by its unique name.
      Parameters:
      name - the category name to search for
      Returns:
      an Optional containing the category if found
    • existsByName

      boolean existsByName(String name)
      Checks whether a category with the given name already exists.
      Parameters:
      name - the category name to check
      Returns:
      true if a category with this name exists