Class InventoryDAOImpl
- java.lang.Object
-
- ejava.examples.ejbwar.inventory.dao.InventoryDAOImpl
-
- All Implemented Interfaces:
InventoryDAO
public class InventoryDAOImpl extends Object implements InventoryDAO
This DAO implementation uses JPA and an injected entity manager to perform CRUD operations on inventory data.
-
-
Field Summary
Fields Modifier and Type Field Description private EntityManagerem
-
Constructor Summary
Constructors Constructor Description InventoryDAOImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddProduct(Product p)private voidapplyBounds(TypedQuery<?> query, int offset, int limit)voidcreateCategory(Category category)voiddeleteCategory(Category category)voiddeleteProduct(Product product)voiddetachCategory(Category category)List<Category>findCategoryByName(String criteria, int offset, int limit)List<Product>findProductsByName(String criteria, int offset, int limit)CategorygetCategory(int id)ProductgetProduct(int id)voidsetEntityManager(EntityManager em)ProductupdateProduct(Product product)
-
-
-
Field Detail
-
em
@Inject private EntityManager em
-
-
Method Detail
-
setEntityManager
public void setEntityManager(EntityManager em)
-
createCategory
public void createCategory(Category category)
- Specified by:
createCategoryin interfaceInventoryDAO
-
getCategory
public Category getCategory(int id)
- Specified by:
getCategoryin interfaceInventoryDAO
-
findCategoryByName
public List<Category> findCategoryByName(String criteria, int offset, int limit)
- Specified by:
findCategoryByNamein interfaceInventoryDAO
-
detachCategory
public void detachCategory(Category category)
- Specified by:
detachCategoryin interfaceInventoryDAO
-
deleteCategory
public void deleteCategory(Category category)
- Specified by:
deleteCategoryin interfaceInventoryDAO
-
addProduct
public void addProduct(Product p)
- Specified by:
addProductin interfaceInventoryDAO
-
getProduct
public Product getProduct(int id)
- Specified by:
getProductin interfaceInventoryDAO
-
updateProduct
public Product updateProduct(Product product)
- Specified by:
updateProductin interfaceInventoryDAO
-
findProductsByName
public List<Product> findProductsByName(String criteria, int offset, int limit)
- Specified by:
findProductsByNamein interfaceInventoryDAO
-
deleteProduct
public void deleteProduct(Product product)
- Specified by:
deleteProductin interfaceInventoryDAO
-
applyBounds
private void applyBounds(TypedQuery<?> query, int offset, int limit)
-
-