@Test public void getsAProductListByCategory() { List<Product> products = persistence.getProductListByCategory(category.getCategoryId()); assertThat(products.size(), equalTo(1)); assertReflectionEquals(product, products.get(0)); }
@Override public List<Product> getProductListByCategory(final String categoryId) { Category category = entityManager.find(Category.class, categoryId); Query query = createNamedQuery("Product.getProductListByCategory"); query.setParameter("category", category); @SuppressWarnings("unchecked") List<Product> products = (List<Product>) query.getResultList(); logger.info("Read [{}] products by category", products.size()); return products; }
ProductBasePersistence extends AbstractBasePersistence<Product, String> implements ProductMapper { @Override public List<Product> getProductListByCategory(final String categoryId) { Category category = entityManager.find(Category.class, categoryId); Query query = createNamedQuery("Product.getProductListByCategory"); query.setParameter("category", category); @SuppressWarnings("unchecked") List<Product> products = (List<Product>) query.getResultList(); logger.info("Read [{}] products by category", products.size()); return products; } }
ProductBasePersistence extends AbstractBasePersistence<Product, String> implements ProductMapper { @Override public List<Product> getProductListByCategory(final String categoryId) { Category category = entityManager.find(Category.class, categoryId); Query query = createNamedQuery("Product.getProductListByCategory"); query.setParameter("category", category); @SuppressWarnings("unchecked") List<Product> products = (List<Product>) query.getResultList(); logger.info("Read [{}] products by category", products.size()); return products; }  }
ProductBasePersistence extends AbstractBasePersistence<Product, String> implements ProductMapper { @Override public List<Product> getProductListByCategory(final String categoryId) { Category category = entityManager.find(Category.class, categoryId); Query query = createNamedQuery("Product.getProductListByCategory"); query.setParameter("category", category); @SuppressWarnings("unchecked") List<Product> products = (List<Product>) query.getResultList(); logger.info("Read [{}] products by category", products.size()); return products; }  @Override List<Product> getProductListByCategory(final String categoryId); @Override Product getProduct(final String productId); @Override List<Product> searchProductList(final String name); }
ProductBasePersistence extends AbstractBasePersistence<Product, String> implements ProductMapper { @Override public List<Product> getProductListByCategory(final String categoryId) { Category category = entityManager.find(Category.class, categoryId); Query query = createNamedQuery("Product.getProductListByCategory"); query.setParameter("category", category); @SuppressWarnings("unchecked") List<Product> products = (List<Product>) query.getResultList(); logger.info("Read [{}] products by category", products.size()); return products; }  @Override List<Product> getProductListByCategory(final String categoryId); @Override Product getProduct(final String productId); @Override List<Product> searchProductList(final String name);  }