Spring-data Jpa does not need to execute the save statement, and the Set field can automatically execute the save method? solve

  java, question
public Optional<User> requestPasswordReset(String mail) {
 return userRepository.findOneByEmail(mail)
 .map(user -> {// updata
 return user;

//Enter the breakpoint, check the print result through the back end, and find that the select statement is executed first, and then the update statement is executed. I do not quite understand why after set
//You can update without the save method.

After following the code, I went to this method and executed the update statement, asking the great god to see and teach me. I am very grateful! I must pay attention to you.


To understand the persistence context of JPA!