How do I update an entity using spring-data-jpa?

后端 未结 10 1812
眼角桃花
眼角桃花 2020-11-29 15:12

Well the question pretty much says everything. Using JPARepository how do I update an entity?

JPARepository has only a save method, which does not t

10条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-29 15:43

    Using spring-data-jpa save(), I was having same problem as @DtechNet. I mean every save() was creating new object instead of update. To solve this I had to add version field to entity and related table.

提交回复
热议问题