If I may add some personal opinion here: When querying the ORM for entities, I would expect any restrictions (be it "WHERE" conditions or "LIMIT/OFFSET/TOP/ROWNUM/...") I expect the restrictions to be applied to queried entities and not any of the relationships. For example, if I query for the first 5 parents with setMaxResults(5), I expect to get the first 5 parents with all their children, not with their respective first 5 children.

If I want to put restrictions on a collection, I would either do that in Java (Hibernate query on the persistent collection or something like LambdaJ), or query the ORM for the collection elements (depending on which makes most sense performance wise in a given situation).

Sorry if this is a bit n00b (because it was too long ago I worked with this particular issue, and I don't have the time to refresh my memory), when you say the restriction is applied to a fetched collection, does that imply it is possible to write such Critera, without having the collection JOIN fetched, i.e. parentCriteria.createCriteria("children", JoinFragment.LEFT_OUTER_JOIN).add(...) + parentCriteria.setFetchMode("children", FetchMode.SELECT)?

If that is an alternative, I might be convinced to change my mind. Otherwise it seems more straightforward to me to filter the children after the parent query, than having to "unfilter" if you need them all.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira