title: SpringBoot update methods is working fine but doesn't update to entity on database
body: <p>This is my service method.</p>
  <pre><code>    public UserDto updateUserS(Long id, UserDto userDto) {
  
      UserDto userDtoNew = null;
  
      if (userRepository.findById(id).isPresent()) {
  
          User existingUser = userRepository.findById(id).get();
          existingUser.setPassword(userDto.getPassword());
          existingUser.setUserName(userDto.getUserName());
          userDtoNew = userMapper.toDto(existingUser);
  
          return userDtoNew;
      }
  
      return userDtoNew;
  }
  </code></pre>
  <p>And this is my controller method.</p>
  <pre><code>@PutMapping(&quot;/update/{id}&quot;)
  public ResponseEntity&lt;UserDto&gt; updateUser(@PathVariable Long id, @RequestBody UserDto 
   userDto) {
  
      return ResponseEntity.ok(userService.updateUserS(id, userDto));
  
  }
  </code></pre>
  <p>When I try to update my User by put request on a new json via Postman. My controller is working. I can see the new User on the Postman. But When I check my database  I saw the entity doesn't update in my database.</p>
  <p>I didn't share all my codes like: entity, dto, repository, mapper. I'm using mapstruct as a mapper. Everythings is working fine.</p>
  <p>I hope you can understand what am I missing.</p>