The best way to use the JPQL DISTINCT keyword with JPA and Hibernate

Introduction In this article, we are going to how the JPQL DISTINCT keyword behaves depending on the underlying entity query type.

How to optimize the merge operation using update while batching with JPA and Hibernate

Introduction One of my readers has recently asked me about optimizing the merge entity state transition, and, because this is a great question, I decided to turn it into a blog post. In this article, you are going to see a shortcoming of the merge entity state transition and how you can deal with it using Hibernate.