• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJBQL distinct question

Johann Dobbins
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I execute a query like:

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?

Thank You
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic