@Test public void searchesAProductListByName() { List<Product> products = persistence.searchProductList(product.getName().toLowerCase()); assertThat(products.size(), equalTo(1)); assertReflectionEquals(product, products.get(0)); assertReflectionEquals(category, product.getCategory()); }
@Override public List<Product> searchProductList(final String name) { Query query = createNamedQuery("Product.searchProductList"); query.setParameter("name", name); @SuppressWarnings("unchecked") List<Product> products = (List<Product>) query.getResultList(); logger.info("Read [{}] products by name", products.size()); return products; }
ProductBasePersistence extends AbstractBasePersistence<Product, String> implements ProductMapper { @Override public List<Product> searchProductList(final String name) { Query query = createNamedQuery("Product.searchProductList"); query.setParameter("name", name); @SuppressWarnings("unchecked") List<Product> products = (List<Product>) query.getResultList(); logger.info("Read [{}] products by name", products.size()); return products; } }
ProductBasePersistence extends AbstractBasePersistence<Product, String> implements ProductMapper { @Override public List<Product> searchProductList(final String name) { Query query = createNamedQuery("Product.searchProductList"); query.setParameter("name", name); @SuppressWarnings("unchecked") List<Product> products = (List<Product>) query.getResultList(); logger.info("Read [{}] products by name", products.size()); return products; }  }
ProductBasePersistence extends AbstractBasePersistence<Product, String> implements ProductMapper { @Override public List<Product> searchProductList(final String name) { Query query = createNamedQuery("Product.searchProductList"); query.setParameter("name", name); @SuppressWarnings("unchecked") List<Product> products = (List<Product>) query.getResultList(); logger.info("Read [{}] products by name", 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> searchProductList(final String name) { Query query = createNamedQuery("Product.searchProductList"); query.setParameter("name", name); @SuppressWarnings("unchecked") List<Product> products = (List<Product>) query.getResultList(); logger.info("Read [{}] products by name", products.size()); return products; }  @Override List<Product> getProductListByCategory(final String categoryId); @Override Product getProduct(final String productId); @Override List<Product> searchProductList(final String name);  }