FORGE-1085 Added code to generate ORDER BY clause.

This ensures that collections are ordered by the primary key in the resource representations for top-level collections.