I think the "right" way might be more like:
@Entity
class Post {
...
public GenericModel.JPAQuery getComments() {
return Comment.find("post_id = ?", post_id);
}
}
and then use one of the fetch
methods in JPAQuery
:
// fetch first page of results, 25 results per page
post.getComments().fetch(1,25);