title: How to update and save record in table using Spring JPA
body: <p>I have a scenario where I am receiving events from Kafka topic and then I need to save the event into the table. I am using Spring Boot project and using jpa and jdbc</p>
  <p>Here the only condition is if the record is already present in the table then update the record else if it is not present then insert that new record in that table</p>
  <p>What I thought of is using if the unique key or primary does not exists in the table then save it else <strong>here I am not able to think of a solution</strong>. If I use this approach it's taking a lot of DB hits. I get 9000+ events in a day</p>