You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
895 B
36 lines
895 B
package com.mousetech.gourmetj.persistence.service;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.List;
|
|
import jakarta.enterprise.context.ApplicationScoped;
|
|
import jakarta.inject.Inject;
|
|
import jakarta.inject.Named;
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import com.mousetech.gourmetj.persistence.dao.CategoryRepository;
|
|
import com.mousetech.gourmetj.persistence.model.Category;
|
|
|
|
@Named
|
|
@ApplicationScoped
|
|
@Transactional
|
|
public class CategoryService implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
@Inject
|
|
private CategoryRepository categoryRepository;
|
|
|
|
|
|
public List<Category> findAll() {
|
|
return categoryRepository.findAll();
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @return All Category names that are not null/blank, sorted.
|
|
*/
|
|
public List<String> findCategoryNames() {
|
|
return categoryRepository.findDistinctCategoryNative();
|
|
}
|
|
}
|
|
|