Hibernate Tips is a series of posts in which I describe a quick and easy solution for common Hibernate questions. If you have a question for a future Hibernate Tip, please post a comment below.
I’m using a query with a JOIN FETCH clause to load parent entities with all their child entities. The JPQL query requires the DISTINCT keyword to return each parent entity only once. I don’t want the DISTINCT in the SQL query. How can I tell Hibernate to use the DISTINCT only in the JPQL query?
[Continue reading] about Hibernate Tips: How To Apply DISTINCT to Your JPQL But Not Your SQL Query