Search code examples
hibernatespring-bootjooq

What is the equivalent of hibernate's saveOrUpdate method in jooq?


I want to update row if it exists otherwise insert it. Is there any convenience method like hibernate's saveOrUpdate in jooq?

Currently i am checking in database if it exists then run update query otherwise insert it.


Solution

  • You can use one of the different UPSERT statements supported by jOOQ, depending on your RDBMS: