[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-980) FetchMode.SELECT javadoc wrong

Gabriel Falkenberg (JIRA) noreply at atlassian.com
Fri Apr 25 05:03:33 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-980?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_30072 ] 

Gabriel Falkenberg commented on HHH-980:
----------------------------------------

The two Jiira issues about FetchMode.SELECT (this one and HHH1211) seems to imply that maybe the documentation needs to be updated after all. The javadoc at http://www.hibernate.org/hib_docs/core/api/org/hibernate/FetchMode.html says:

SELECT
Fetch eagerly, using a separate select. Equivalent to fetch="select".

LAZY
Deprecated. use FetchMode.SELECT
Fetch lazily. Equivalent to outer-join="false".

So FetchMode.SELECT is eager but it should also be used instead of FetchMode.LAZY which is Lazy, what gives? Am I interpreting the words in the wrong way? Reading the above statement about FetchMode.SELECT makes me think that the following code should load a Foo-object with one select and the associated "bars" in another select:

Foo getFooWithBarsBySomeProp(String propValue)
{
        Criteria criteria = getSession().createCriteria(Foo.class);
        criteria.add(Restrictions.eq("someProp", propValue));
        criteria.setFetchMode("bars", FetchMode.SELECT);
        return (Foo) criteria.uniqueResult();
}

But when I run this and logs the SQL I can see that only one select is performed. It would be very helpful it this could be elaborated on in the documentation.

> FetchMode.SELECT javadoc wrong
> ------------------------------
>
>                 Key: HHH-980
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-980
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: documentation
>    Affects Versions: 3.1 beta 2
>            Reporter: Dave Brondsema
>            Priority: Minor
>
> FetchMode.SELECT says "Fetch eagerly, using a separate select." but it should say "Fetch lazily, using a separate select."
> This is quite misleading

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list