2627282930313233
public void save(Product p) { em.merge(p); } public void delete(Product p) { Product px = em.find(Product.class, p.getId()); em.remove(px); }
5455565758596061
return null; } public void reset() { findAll(); selectedProduct = new Product(); System.out.println("RESET CALLED by Product"); }
@Override public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) { if (!(arg2 instanceof Product)) return ""; Product product = (Product) arg2; return product.getId().toString(); }