Update or saveorUpdate in CRUDRepository

前端 未结 2 782
别跟我提以往
别跟我提以往 2020-12-28 18:18

I know there\'s already a similar question answered previously, but my problem is implementing save with update while there are 3 methods in the interface. I\'m currently us

2条回答
  •  -上瘾入骨i
    2020-12-28 18:38

    putting below if check resolve my issue and save method is working as save and update both when i pass id it updates the record in database and when i dont pass id it save new record in database place is incoming object in my case and new place is new object of place in which i am setting the place id

        if(place.getPlaceId()!=0)
            newPlace.setPlaceId(place.getPlaceId());
    

提交回复
热议问题