Hello, faced with an interesting problem. According to the documentation, the save method for SpringBoot can either save a new object or edit an already saved one. The problem is the following: when I try to edit an object, springboot edits this object and then duplicates the old one and also saves it. As you can see from the example, the object that I am editing is first located using id For example,
Question qq = questionRepository.findQuestionById(id); qq.setPicture(filename); questionRepository.save(qq); Gives as a result in a database:
id: 1, name: test, picture: testpicture and
id: 2, name: test, picture: NULL
CrudRepository has only save but it acts as update as well. When you do save on entity with existing id it will do an updateI know for sure that save performs two functions - Julia