@Test public void getsAnItemListByCategory() { List<Item> items = persistence.getItemListByProduct(product.getProductId()); assertThat(items.size(), equalTo(1)); assertHaveSamePersistentFields(item, items.get(0), "supplier"); }
@Override public List<Item> getItemListByProduct(@Nonnull final String productId) { Product product = entityManager.find(Product.class, productId); Query query = createNamedQuery("Item.getItemListByProduct"); query.setParameter("product", product); @SuppressWarnings("unchecked") List<Item> items = (List<Item>) query.getResultList(); logger.info("Read [{}] item(s) for product[{}]", items.size(), productId); return items; }
ItemBasePersistence extends AbstractBasePersistence<Item, String> implements ItemMapper { @Override public List<Item> getItemListByProduct(@Nonnull final String productId) { Product product = entityManager.find(Product.class, productId); Query query = createNamedQuery("Item.getItemListByProduct"); query.setParameter("product", product); @SuppressWarnings("unchecked") List<Item> items = (List<Item>) query.getResultList(); logger.info("Read [{}] item(s) for product[{}]", items.size(), productId); return items; } }
ItemBasePersistence extends AbstractBasePersistence<Item, String> implements ItemMapper { @Override public List<Item> getItemListByProduct(@Nonnull final String productId) { Product product = entityManager.find(Product.class, productId); Query query = createNamedQuery("Item.getItemListByProduct"); query.setParameter("product", product); @SuppressWarnings("unchecked") List<Item> items = (List<Item>) query.getResultList(); logger.info("Read [{}] item(s) for product[{}]", items.size(), productId); return items; }  }
ItemBasePersistence extends AbstractBasePersistence<Item, String> implements ItemMapper { @Override public List<Item> getItemListByProduct(@Nonnull final String productId) { Product product = entityManager.find(Product.class, productId); Query query = createNamedQuery("Item.getItemListByProduct"); query.setParameter("product", product); @SuppressWarnings("unchecked") List<Item> items = (List<Item>) query.getResultList(); logger.info("Read [{}] item(s) for product[{}]", items.size(), productId); return items; }  @Override void updateInventoryQuantity(@Nonnull final Map<String, Object> param); @Override int getInventoryQuantity(@Nonnull final String itemId); @Override List<Item> getItemListByProduct(@Nonnull final String productId); @Override Item getItem(@Nonnull final String itemId); }
ItemBasePersistence extends AbstractBasePersistence<Item, String> implements ItemMapper { @Override public List<Item> getItemListByProduct(@Nonnull final String productId) { Product product = entityManager.find(Product.class, productId); Query query = createNamedQuery("Item.getItemListByProduct"); query.setParameter("product", product); @SuppressWarnings("unchecked") List<Item> items = (List<Item>) query.getResultList(); logger.info("Read [{}] item(s) for product[{}]", items.size(), productId); return items; }  @Override void updateInventoryQuantity(@Nonnull final Map<String, Object> param); @Override int getInventoryQuantity(@Nonnull final String itemId); @Override List<Item> getItemListByProduct(@Nonnull final String productId); @Override Item getItem(@Nonnull final String itemId);  }