I recently stumbled upon Hibernate StatelessSession Upsert through the UPSERT discussion on JPA which talks about doing upsert operations like
doInStatelessHibernate(session -> {
session.upsert(
new Book()
.setId(1L)
.setTitle("High-Performance Hibernate")
.setIsbn("978-9730228236")
);
});
There’s an question with using StatelessSession with Spring Data which I think would have the starting point of an upsert implementation, but I’d rather use the repository operations if possible.