domain: Use DISTINCT for entity queries with joins.