Added DAO level

This commit is contained in:
Tim Holloway 2021-12-28 15:33:35 -05:00
parent 38455389f7
commit dded11d034
4 changed files with 46 additions and 1 deletions

View File

@ -8,6 +8,7 @@ import javax.inject.Named;
import org.springframework.transaction.annotation.Transactional;
import com.mousetech.gourmetj.persistence.dao.CategoryRepository;
import com.mousetech.gourmetj.persistence.model.Category;
@Named

View File

@ -1,4 +1,4 @@
package com.mousetech.gourmetj;
package com.mousetech.gourmetj.persistence.dao;
import java.util.List;

View File

@ -0,0 +1,33 @@
package com.mousetech.gourmetj.persistence.dao;
import java.util.List;
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> {
// final static String SQL_FIND_CATEGORIES =
// "SELECT DISTINCT category from categories"
// + " where category is not null and category <> ''"
// + " ORDER BY category ASC";
//
// @Query(value = SQL_FIND_CATEGORIES, nativeQuery = true)
// public List<String> findDistinctCategoryNative();
}

View File

@ -0,0 +1,11 @@
/**
* Copyright (C) 2021, Tim Holloway
*
* Date written: Dec 28, 2021
* Author: Tim Holloway <timh@mousetech.com>
*/
/**
* @author timh
* @since Dec 28, 2021
*/
package com.mousetech.gourmetj.persistence.dao;