Esempio n. 1
0
 private void btnDeleteActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnDeleteActionPerformed
   Product product = (Product) lstProducts.getSelectedValue();
   int result =
       JOptionPane.showConfirmDialog(
           this,
           "Are you sure you want to delete Product ID:"
               + product.getProductID()
               + ", Name: "
               + product.getName());
   if (result == JOptionPane.YES_OPTION) {
     dao.delete(product);
   }
   productModel.updateItems(dao.getAll());
 } // GEN-LAST:event_btnDeleteActionPerformed
Esempio n. 2
0
  /* (non-Javadoc)
   * @see service.ProductService#deleteProduct(VO.ProductVo)
   */
  @Override
  public void deleteProduct(ProductVo productVo) {

    Product product = productDao.get(Product.class, productVo.getId());
    productDao.delete(product);
  }