gourmetj-springboot/src/main/java/com/mousetech/gourmetj/persistence/dao/RecipeRepository.java

43 lines
1.1 KiB
Java
Raw Normal View History

2021-12-28 20:33:35 +00:00
package com.mousetech.gourmetj.persistence.dao;
import java.util.List;
import org.springframework.data.jpa.repository.EntityGraph;
2021-12-28 20:33:35 +00:00
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import com.mousetech.gourmetj.persistence.model.Category;
import com.mousetech.gourmetj.persistence.model.Recipe;
/**
* JpaRepository for Recipes, which relate OneToMany for
* Ingredients and Categories.
*
* Service method is @see RecipeService
*
* @author timh
* @since Dec 28, 2021
*/
@Repository
public interface RecipeRepository
extends JpaRepository<Recipe, Long> {
2021-12-29 02:12:23 +00:00
List<Recipe> findByTitleContaining(String searchText);
@EntityGraph(value="Recipe.findWorkingSet")
public Recipe findDetailsById(Long recipeId);
@Query(name = "Recipe.findCusines", nativeQuery = true)
List<String> FindCuisinesNative();
2022-01-09 16:49:04 +00:00
List<Recipe> findByCategories_CategoryContains(String searchText);
List<Recipe> findByCuisineContains(String searchText);
List<Recipe> findDistinctByIngredientHash_ItemContains(
String searchText);
2022-01-09 16:49:04 +00:00
2021-12-28 20:33:35 +00:00
}