I new to hibernate and I don't why I am having this error. I commented out my DAO code for updating and hibernate is still executing an update query. Here is my code for my service.
@Override
@Transactional(readOnly = false)
public void updateProduct(Product productToUpdate) throws DuplicateProductException {
    Product product = productDao.findByProductId(productToUpdate.getProductId());
    if (productDao.findByName(productToUpdate.getName()) != null
            && !product.getName().equals(productToUpdate.getName())) {
        throw new DuplicateProductException();
    }
    product.setName(productToUpdate.getName());
    product.setCategory(productToUpdate.getCategory());
    product.setPrice(productToUpdate.getPrice());
    product.setImage(productToUpdate.getImage());
//      productDao.updateProduct(product);
   }
I commented the DAO out and hibernate is still executing the query.
Here is the code for my controller.
@RequestMapping(value = "/updateProduct", method = RequestMethod.POST)
public String updateProductPost(@Validated @ModelAttribute("product") ProductHelper productHelper,
        BindingResult bindingResult, Model model) throws CategoryNotFoundException {
    model.addAttribute("categories", categoryService.findAll());
    model.addAttribute("activePage", AdminPage.UPDATE_PRODUCT);
    updateProductValidator.validate(productHelper, bindingResult);
    if (bindingResult.hasErrors()) {
        return "admin_home";
    }
    Product product = productHelper.buildProductToUpdate(productService, categoryService);
    try {
        productService.updateProduct(product);
        model.addAttribute("updatedProduct", product);
    } catch (DuplicateProductException e) {
        model.addAttribute("duplicateProduct", product);
    }
    return "admin_home";
}
What's weird is that I've got my entire DAO code commented out:
//  @Override
//  public void updateProduct(Product product) {
////        sessionFactory.getCurrentSession().update(product);
//  }
And still hibernate is executing an update query:
Hibernate: update PRODUCT set category_id=?, image=?, name=?, price=?, product_id=? where id=?
Hibernate: select product0_.id as id1_3_, product0_.category_id as category6_3_, product0_.image as image2_3_, product0_.name as name3_3_, product0_.price as price4_3_, product0_.product_id as product_5_3_ from PRODUCT product0_ where product0_.product_id=?
Hibernate: select product0_.id as id1_3_, product0_.category_id as category6_3_, product0_.image as image2_3_, product0_.name as name3_3_, product0_.price as price4_3_, product0_.product_id as product_5_3_ from PRODUCT product0_ where product0_.name=?
If this is some beginner mistake, I am really sorry but I'm fairly new to hibernate. Thank you.
 
     
     
    