Interface RecipeRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Recipe,
,Long> org.springframework.data.jpa.repository.JpaRepository<Recipe,
,Long> org.springframework.data.jpa.repository.JpaSpecificationExecutor<Recipe>
,org.springframework.data.repository.ListCrudRepository<Recipe,
,Long> org.springframework.data.repository.ListPagingAndSortingRepository<Recipe,
,Long> org.springframework.data.repository.PagingAndSortingRepository<Recipe,
,Long> org.springframework.data.repository.query.QueryByExampleExecutor<Recipe>
,org.springframework.data.repository.Repository<Recipe,
Long>
@Repository
public interface RecipeRepository
extends org.springframework.data.jpa.repository.JpaRepository<Recipe,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Recipe>
This repository provides CRUD operations for the Recipe entity.
It extends JpaRepository and JpaSpecificationExecutor interfaces.
JpaRepository provides basic CRUD operations while JpaSpecificationExecutor provides
search functionality using specifications.
-
Method Summary
Modifier and TypeMethodDescriptionfindByRecipeId
(Long recipeId) This method retrieves a recipe by recipe id.findByRecipeNameContainingIgnoreCase
(String recipeName, org.springframework.data.domain.Pageable pageable) This method retrieves a page of recipes by recipe name.findRandomSubset
(org.springframework.data.domain.Pageable pageable) This method retrieves a random list of recipe objects given paging details.findRecipeByRecipeNameContainingIgnoreCase
(String recipeName) This method retrieves a recipe by its 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.jpa.repository.JpaSpecificationExecutor
count, delete, exists, findAll, findAll, findAll, findBy, findOne
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
-
findRecipeByRecipeNameContainingIgnoreCase
This method retrieves a recipe by its name.- Parameters:
recipeName
- Name of the recipe, given as a String.- Returns:
- An optional of the recipe.
-
findByRecipeNameContainingIgnoreCase
Optional<org.springframework.data.domain.Page<Recipe>> findByRecipeNameContainingIgnoreCase(String recipeName, org.springframework.data.domain.Pageable pageable) This method retrieves a page of recipes by recipe name.- Parameters:
recipeName
- Name of recipe, given as a Stringpageable
- The paging information, given as a Pageable object.- Returns:
- An optional containing the page of recipes.
-
findByRecipeId
This method retrieves a recipe by recipe id.- Parameters:
recipeId
- Id of the recipe.- Returns:
- An optional containing the recipe.
-
findRandomSubset
@Query("SELECT r FROM Recipe r ORDER BY RAND()") List<Recipe> findRandomSubset(org.springframework.data.domain.Pageable pageable) This method retrieves a random list of recipe objects given paging details.- Parameters:
pageable
- Paging details, given as a Pageable object.- Returns:
- A list of random recipes.
-