Added DAO level
This commit is contained in:
		
							parent
							
								
									38455389f7
								
							
						
					
					
						commit
						dded11d034
					
				| 
						 | 
					@ -8,6 +8,7 @@ import javax.inject.Named;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.springframework.transaction.annotation.Transactional;
 | 
					import org.springframework.transaction.annotation.Transactional;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.mousetech.gourmetj.persistence.dao.CategoryRepository;
 | 
				
			||||||
import com.mousetech.gourmetj.persistence.model.Category;
 | 
					import com.mousetech.gourmetj.persistence.model.Category;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Named
 | 
					@Named
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
package com.mousetech.gourmetj;
 | 
					package com.mousetech.gourmetj.persistence.dao;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -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;
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user