@Transactional(readOnly = false, propagation = Propagation.REQUIRED) @Caching( evict = { @CacheEvict(value = "indexes", key = "#pid"), @CacheEvict(value = "product", key = "#pid"), @CacheEvict(value = "products", allEntries = true) }) @IncrementCache(name = "product_count", key = "all", value = -1) public void systemDeleteProduct(Long pid) { Product product = productDao.read(pid); if (product == null) { throw new DataStoreException("Product #" + pid + " not found in the system."); } if (product.getLocked()) { throw new DataStoreException( "Cannot delete product #" + pid + ". Product is locked in the system."); } productDao.delete(product); }