Because of the one-to-many relationship between parent and children I get a non-unique list of results (one result per parent-child relationship). In order to return a unique collection, I convert this list to a set.
This seems significantly wasteful. Not only am I converting one collection to another, I'm performing an unknown number of unnecessary fetch joins. In order to avoid this, I've tried:
But, I'm pretty sure this just processes the resultList and removes non-unique entry. It provides no performance improvement.
Any suggestions how to write this query more efficiently?