public interface Catalog<T extends Product> extends org.springframework.data.repository.CrudRepository<T,ProductIdentifier>
Product
sModifier and Type | Method and Description |
---|---|
org.springframework.data.util.Streamable<T> |
findByAllCategories(Collection<String> categories)
Returns all
Product that are assigned to all given categories. |
default org.springframework.data.util.Streamable<T> |
findByAllCategories(String... categories)
Returns all
Product that are assigned to all given categories. |
org.springframework.data.util.Streamable<T> |
findByAnyCategory(Collection<String> categories)
Returns all
Product s that are assigned to any of the given categories. |
default org.springframework.data.util.Streamable<T> |
findByAnyCategory(String... categories)
Returns all
Product s that are assigned to any of the given categories. |
org.springframework.data.util.Streamable<T> |
findByCategory(String category)
Returns all
Product s assigned to the given category. |
org.springframework.data.util.Streamable<T> |
findByName(String name)
Returns the
Product s with the given name. |
@Query(value="select p from #{#entityName} p where :category member of p.categories") org.springframework.data.util.Streamable<T> findByCategory(String category)
Product
s assigned to the given category.category
- default org.springframework.data.util.Streamable<T> findByAllCategories(String... categories)
Product
that are assigned to all given categories.categories
- must not be null.@Query(value="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)
Product
that are assigned to all given categories.categories
- must not be null.default org.springframework.data.util.Streamable<T> findByAnyCategory(String... categories)
Product
s that are assigned to any of the given categories.categories
- must not be null.@Query(value="select p from #{#entityName} p join p.categories c where c in :categories") org.springframework.data.util.Streamable<T> findByAnyCategory(Collection<String> categories)
Product
s that are assigned to any of the given categories.categories
- must not be null.Copyright © 2019. All rights reserved.