Interface ItemRepository
- All Superinterfaces:
org.springframework.data.repository.CrudRepository<Item,
,Long> org.springframework.data.jpa.repository.JpaRepository<Item,
,Long> org.springframework.data.jpa.repository.JpaSpecificationExecutor<Item>
,org.springframework.data.repository.ListCrudRepository<Item,
,Long> org.springframework.data.repository.ListPagingAndSortingRepository<Item,
,Long> org.springframework.data.repository.PagingAndSortingRepository<Item,
,Long> org.springframework.data.repository.query.QueryByExampleExecutor<Item>
,org.springframework.data.repository.Repository<Item,
Long>
@Repository
public interface ItemRepository
extends org.springframework.data.jpa.repository.JpaRepository<Item,Long>, org.springframework.data.jpa.repository.JpaSpecificationExecutor<Item>
This repository provides CRUD operations for the Item entity.
It extends JpaRepository and JpaSpecificationExecutor interfaces.
JpaRepository provides basic CRUD operations while JpaSpecificationExecutor provides
search functionality using specifications.
-
Method Summary
Modifier and TypeMethodDescriptionfindByItemId
(Long itemId) Finds an item by its items ID.findByProductNameAndStore
(String name, Store store) Finds an item by its item name and store.findItemByEanAndStore_StoreName
(String ean, String storeName) This method finds items with a given ean.findItemByProductName
(String productName) Finds an items by their product name.findItemByProductNameAndStore_StoreName
(String productName, String storeName) This method finds items with a given store name and product name.Finds a list of items whose brief description contains the given phrase, ignoring case.findItemsByEan
(String ean) This method finds items with a given ean.findItemsByPriceBetween
(double lowerBound, double upperBound) Finds items with prices between the given lower and upper bounds (inclusive).findItemsByPriceGreaterThan
(double price) Finds items with prices greater than the given price.findItemsByPriceGreaterThanEqual
(double price) Finds items with prices greater than or equal to the given price.findItemsByPriceLessThan
(double price) Finds a list of items whose price is less than the given price.findItemsByPriceLessThanEqual
(double price) Finds items with prices less than or equal to the given price.findItemsByStore
(Store store) Finds a list of items by their store.Methods inherited from interface org.springframework.data.repository.CrudRepository
count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save
Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository
deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush
Methods inherited from interface org.springframework.data.jpa.repository.JpaSpecificationExecutor
count, delete, exists, findAll, findAll, findAll, findBy, findOne
Methods inherited from interface org.springframework.data.repository.ListCrudRepository
findAll, findAllById, saveAll
Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository
findAll
Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository
findAll
Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor
count, exists, findAll, findBy, findOne
-
Method Details
-
findByItemId
Finds an item by its items ID.- Parameters:
itemId
- the ID of the item to find- Returns:
- an Optional containing the item with the given ID, or an empty Optional if no such item exists
-
findByProductNameAndStore
Finds an item by its item name and store.- Parameters:
name
- the name of the item to findstore
- the store to use- Returns:
- an Optional containing the item with the given name and store, or an empty Optional if no such item exists
-
findItemsByStore
Finds a list of items by their store.- Parameters:
store
- the store of the items to find- Returns:
- an Optional containing the list of items with the given main category, or an empty Optional if no such items exist
-
findItemsByDescContainingIgnoreCase
Finds a list of items whose brief description contains the given phrase, ignoring case.- Parameters:
phrase
- the phrase to search for- Returns:
- an Optional containing the list of items whose brief description contains the given phrase, or an empty Optional if no such items exist
-
findItemByProductName
Finds an items by their product name.- Parameters:
productName
- the product name to search for- Returns:
- an Optional containing the items with the given product name, or an empty Optional if no such items exist
-
findItemsByPriceLessThan
Finds a list of items whose price is less than the given price.- Parameters:
price
- the maximum price of the items to find- Returns:
- an Optional containing the list of items whose price is less than the given price, or an empty Optional if no such items exist
-
findItemsByPriceLessThanEqual
Finds items with prices less than or equal to the given price.- Parameters:
price
- The maximum price to search for.- Returns:
- An optional list of items with prices less than or equal to the given price.
-
findItemsByPriceGreaterThan
Finds items with prices greater than the given price.- Parameters:
price
- The minimum price to search for.- Returns:
- An optional list of items with prices greater than the given price.
-
findItemsByPriceGreaterThanEqual
Finds items with prices greater than or equal to the given price.- Parameters:
price
- The minimum price to search for.- Returns:
- An optional list of items with prices greater than or equal to the given price.
-
findItemsByPriceBetween
Finds items with prices between the given lower and upper bounds (inclusive).- Parameters:
lowerBound
- The lower bound of the price range.upperBound
- The upper bound of the price range.- Returns:
- An optional list of items with prices between the given lower and upper bounds.
-
findItemsByEan
This method finds items with a given ean.- Parameters:
ean
- The ean to be checked, given as String.- Returns:
- An optional list of items containing the ean provided.
-
findItemByEanAndStore_StoreName
This method finds items with a given ean.- Parameters:
ean
- The ean to be checked, given as String.storeName
- Name of the store, given as a String.- Returns:
- An optional list of items containing the ean provided.
-
findItemByProductNameAndStore_StoreName
This method finds items with a given store name and product name.- Parameters:
productName
- Name of the product, given as a String.storeName
- Name of the store, given as a String.- Returns:
- An optional list of items containing the ean provided.
-