Why doesn't nHibernate support LIMIT when doing "join fetch"?

Posted by HeavyWave on Stack Overflow See other posts from Stack Overflow or by HeavyWave
Published on 2010-03-29T11:51:13Z Indexed on 2010/03/29 11:53 UTC
Read the original article Hit count: 400

Filed under:

In nHibernate, if you do an HQL query with "join fetch" to eagerly load a child collection, nHibernate will ignore SetMaxResults and SetFirstResult and try to retrieve every single item from the database. Why? This behavior is specific to HQL, as ICriteria supports eager loading (with an outer join, though) and LIMIT.

There are more details here http://www.lesnikowski.com/blog/index.php/nhibernate-ignores-setmaxresults-in-sql/ .

© Stack Overflow or respective owner

Related posts about nhibernate