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; /** * JpaRepository for Categories, which relate ManyToOne to Recipe. * Service method is @see CategoryService * * @author timh * @since Dec 28, 2021 */ @Repository public interface CategoryRepository extends JpaRepository { 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 findDistinctCategoryNative(); }