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 EntityManager
em
-
Constructor Summary
Constructors Constructor Description InventoryDAOImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProduct(Product p)
private void
applyBounds(TypedQuery<?> query, int offset, int limit)
void
createCategory(Category category)
void
deleteCategory(Category category)
void
deleteProduct(Product product)
void
detachCategory(Category category)
List<Category>
findCategoryByName(String criteria, int offset, int limit)
List<Product>
findProductsByName(String criteria, int offset, int limit)
Category
getCategory(int id)
Product
getProduct(int id)
void
setEntityManager(EntityManager em)
Product
updateProduct(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:
createCategory
in interfaceInventoryDAO
-
getCategory
public Category getCategory(int id)
- Specified by:
getCategory
in interfaceInventoryDAO
-
findCategoryByName
public List<Category> findCategoryByName(String criteria, int offset, int limit)
- Specified by:
findCategoryByName
in interfaceInventoryDAO
-
detachCategory
public void detachCategory(Category category)
- Specified by:
detachCategory
in interfaceInventoryDAO
-
deleteCategory
public void deleteCategory(Category category)
- Specified by:
deleteCategory
in interfaceInventoryDAO
-
addProduct
public void addProduct(Product p)
- Specified by:
addProduct
in interfaceInventoryDAO
-
getProduct
public Product getProduct(int id)
- Specified by:
getProduct
in interfaceInventoryDAO
-
updateProduct
public Product updateProduct(Product product)
- Specified by:
updateProduct
in interfaceInventoryDAO
-
findProductsByName
public List<Product> findProductsByName(String criteria, int offset, int limit)
- Specified by:
findProductsByName
in interfaceInventoryDAO
-
deleteProduct
public void deleteProduct(Product product)
- Specified by:
deleteProduct
in interfaceInventoryDAO
-
applyBounds
private void applyBounds(TypedQuery<?> query, int offset, int limit)
-
-