I believe this post answers your question:
Why to use returned instance after save() on Spring Data JPA Repository?
The repository.save() method actually returns a new object like JPA entityManager.merge() and the returned object is the one that will have the ID set.