Fixed 'java.lang.IllegalArgumentException: Undeclared path ...' when creating a OrderBy with subquery