FORGE-1084 Add DISTINCT keyword to generated JPQL queries.

This ensures that duplicate elements from the query result are not
serialized in the resource representations.