title: Increase the count in the database , Spring boot
body: <p>I am working on a project using Spring boot and hibernate. I want to record the number of times an item is executed.</p>
  
  <p>The android app will have a button to execute. As soon as user clicks the button. I want to update the database count for execution, and for every execution I want to increment the count.</p>
  
  <p>Below is the get and post controller. When the user posts details I want to increment the count in the table by the number of times user clicks the button and posts.</p>
  
  <pre><code>@RestController
  @RequestMapping(value = "/item", produces = MediaType.APPLICATION_JSON_VALUE)
  public class ItemController {
      @Autowired
      private ItemExecRepository itemExecRepository;
  
      @RequestMapping(method = RequestMethod.GET)
      @ResponseStatus(HttpStatus.OK)
      @Transactional(Transactional.TxType.NEVER)
      public Iterable&lt;ItemExec&gt; getAllItems() {
          return itemExecRepository.findAll();
      }
  
      @RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
      @ResponseStatus(HttpStatus.OK)
      public void itemExec(@RequestBody ItemExec itemExec) {
          itemExecRepository.save(itemExec);
      }
  }
  </code></pre>
  
  <p>Any help on this will be appreciated</p>