Reputation: 313
I have requirement to only update in table and not insert or select in that table. If a record is present then update or else ignore. How to please implement this using JPA?
Upvotes: 0
Views: 375
Reputation: 1023
First of all do findById(), if entity is returnted for that id, then you can go for update otherwise you can skip
UserEntity entity=repo.findById(1111);
if(null!=entity){
//code for update
repo.save(entity)
}
Upvotes: 1