@Test public void deleteProductReferences () { Product product = new Product (); product.setId (5L); dao.deleteProductReferences (product); List<ProductCart> pcs = dao.readAll (); for (ProductCart pc : pcs) { assertFalse (pc.getProducts ().contains (product)); } }
public void deleteProductReferences(final Product product) { getHibernateTemplate().execute ( new HibernateCallback<Void>() { public Void doInHibernate(Session session) throws HibernateException, SQLException { session.createSQLQuery( "DELETE FROM CART_PRODUCTS p " + " WHERE p.PRODUCT_ID = :pid"). setParameter ("pid", product.getId()).executeUpdate (); return null; } }); }
ProductCartDao extends HibernateDao<ProductCart, String> { public void deleteProductReferences(final Product product) { getHibernateTemplate().execute ( new HibernateCallback<Void>() { public Void doInHibernate(Session session) throws HibernateException, SQLException { session.createSQLQuery( "DELETE FROM CART_PRODUCTS p " + " WHERE p.PRODUCT_ID = :pid"). setParameter ("pid", product.getId()).executeUpdate (); return null; } }); } }
ProductCartDao extends HibernateDao<ProductCart, String> { public void deleteProductReferences(final Product product) { getHibernateTemplate().execute ( new HibernateCallback<Void>() { public Void doInHibernate(Session session) throws HibernateException, SQLException { session.createSQLQuery( "DELETE FROM CART_PRODUCTS p " + " WHERE p.PRODUCT_ID = :pid"). setParameter ("pid", product.getId()).executeUpdate (); return null; } }); }  }
ProductCartDao extends HibernateDao<ProductCart, String> { public void deleteProductReferences(final Product product) { getHibernateTemplate().execute ( new HibernateCallback<Void>() { public Void doInHibernate(Session session) throws HibernateException, SQLException { session.createSQLQuery( "DELETE FROM CART_PRODUCTS p " + " WHERE p.PRODUCT_ID = :pid"). setParameter ("pid", product.getId()).executeUpdate (); return null; } }); }  static T firstResult(Collection<T> results); ProductCart getCartOfUser(final User user); @SuppressWarnings ("unchecked") List<ProductCart> getCartsOfUser(final User user); void deleteCartOfUser(User user); void deleteProductReferences(final Product product); List<Product> scrollCartOfUser(final User user, final int skip,
         final int top); List<Long> getProductsIdOfCart(User user); }
ProductCartDao extends HibernateDao<ProductCart, String> { public void deleteProductReferences(final Product product) { getHibernateTemplate().execute ( new HibernateCallback<Void>() { public Void doInHibernate(Session session) throws HibernateException, SQLException { session.createSQLQuery( "DELETE FROM CART_PRODUCTS p " + " WHERE p.PRODUCT_ID = :pid"). setParameter ("pid", product.getId()).executeUpdate (); return null; } }); }  static T firstResult(Collection<T> results); ProductCart getCartOfUser(final User user); @SuppressWarnings ("unchecked") List<ProductCart> getCartsOfUser(final User user); void deleteCartOfUser(User user); void deleteProductReferences(final Product product); List<Product> scrollCartOfUser(final User user, final int skip,
         final int top); List<Long> getProductsIdOfCart(User user);  }