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.