Added returnAs method to specify the return type for entity queries.