title: Springboot Jpa - How to update entity to mysql database
body: <p>I want to update the Employee entity, but it does't work, it just adds the entity to the table instead of updating it.</p>
  
  <p><strong>The Controller</strong></p>
  
  <pre class="lang-java prettyprint-override"><code>@PutMapping("updateEmployee/{id}")
  public void updateEmployee(@PathVariable long id, @RequestBody Employee employee) {
          employeeService.updateEmployee(id, employee);
  }
  </code></pre>
  
  <p><strong>The Service connected to the JpaRepository</strong></p>
  
  <pre><code>public void updateEmployee(long id, Employee employee) {
          employeeRepository.save(employee);
  }
  </code></pre>