[hibernate-issues] [Hibernate-JIRA] Created: (WEBSITE-7) HQL doc about setMaxResults and use of "join fetch" is confusing

Anton Mostovoy (JIRA) noreply at atlassian.com
Thu Sep 1 11:23:04 EDT 2011


HQL doc about setMaxResults and use of "join fetch" is confusing
----------------------------------------------------------------

                 Key: WEBSITE-7
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/WEBSITE-7
             Project: Hibernate Website
          Issue Type: Improvement
            Reporter: Anton Mostovoy
            Priority: Minor


The current [HQL documentation|http://docs.jboss.org/hibernate/core/3.6/reference/en-US/html/queryhql.html#queryhql-joins] states:
"The fetch construct cannot be used in queries called using iterate() (though scroll() can be used). Fetch should be used together with setMaxResults() or setFirstResult(), as these operations are based on the result rows which usually contain duplicates for eager collection fetching, hence, the number of rows is not what you would expect. Fetch should also not be used together with impromptu with condition."

Test shows that in 3.6.5, setMaxResults() works correctly when "left join fetch" is used (although it appears to use client side limit, instead of 'rownum' in the sql query). Therefore, I believe the sentence about setMaxResults is very confusion and should be removed.


In docs for 3.2, it read "Note that the fetch construct may not be used in queries called using iterate() (though scroll() can be used). Nor should fetch be used together with setMaxResults() or setFirstResult() as these operations are based on the result rows, which usually contain duplicates for eager collection fetching, hence, the number of rows is not what you'd expect. "

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list