Package org.salespointframework.catalog
Interface Catalog<T extends Product>
-
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<T,ProductIdentifier>,org.springframework.data.repository.Repository<T,ProductIdentifier>
@Repository public interface Catalog<T extends Product> extends org.springframework.data.repository.CrudRepository<T,ProductIdentifier>
Repository interface forProducts- Author:
- Oliver Gierke
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default org.springframework.data.util.Streamable<T>findByAllCategories(String... categories)Returns allProductthat are assigned to all given categories.org.springframework.data.util.Streamable<T>findByAllCategories(Collection<String> categories)Returns allProductthat are assigned to all given categories.default org.springframework.data.util.Streamable<T>findByAnyCategory(String... categories)Returns allProducts that are assigned to any of the given categories.org.springframework.data.util.Streamable<T>findByAnyCategory(Collection<String> categories)Returns allProducts that are assigned to any of the given categories.org.springframework.data.util.Streamable<T>findByCategory(String category)Returns allProducts assigned to the given category.org.springframework.data.util.Streamable<T>findByName(String name)Returns theProducts with the given name.
-
-
-
Method Detail
-
findByCategory
@Query("select p from #{#entityName} p where :category member of p.categories") org.springframework.data.util.Streamable<T> findByCategory(String category)Returns allProducts assigned to the given category.- Parameters:
category-- Returns:
-
findByAllCategories
default org.springframework.data.util.Streamable<T> findByAllCategories(String... categories)
Returns allProductthat are assigned to all given categories.- Parameters:
categories- must not be null.- Returns:
- Since:
- 7.1
-
findByAllCategories
@Query("select p from #{#entityName} p where (select count(c.id) from #{#entityName} p2 inner join p2.categories c where p2.id = p.id and c.id in :categories) = ?#{#categories.size().longValue()}") org.springframework.data.util.Streamable<T> findByAllCategories(Collection<String> categories)Returns allProductthat are assigned to all given categories.- Parameters:
categories- must not be null.- Returns:
- Since:
- 7.1
-
findByAnyCategory
default org.springframework.data.util.Streamable<T> findByAnyCategory(String... categories)
Returns allProducts that are assigned to any of the given categories.- Parameters:
categories- must not be null.- Returns:
- Since:
- 7.1
-
findByAnyCategory
@Query("select p from #{#entityName} p join p.categories c where c in :categories") org.springframework.data.util.Streamable<T> findByAnyCategory(Collection<String> categories)Returns allProducts that are assigned to any of the given categories.- Parameters:
categories- must not be null.- Returns:
- Since:
- 7.1
-
-