[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-6405) setFetchMode ignored in certain cases when using criteria queries

Gail Badner (JIRA) noreply at atlassian.com
Tue Aug 16 14:02:08 EDT 2011


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-6405?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gail Badner updated HHH-6405:
-----------------------------

    Issue Type: Patch  (was: Bug)

> setFetchMode ignored in certain cases when using criteria queries
> -----------------------------------------------------------------
>
>                 Key: HHH-6405
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6405
>             Project: Hibernate Core
>          Issue Type: Patch
>    Affects Versions: 3.6.5, 4.0.0.Beta2
>            Reporter: David Mansfield
>
> Description:
> Setting join type (e.g.) criteria.setJoinType("association.path", FetchType.JOIN) is ignored if the association being set is one of a few types.  I believe many-to-many, and any association off of a collection-of-component.  For these types of associations, the specified fetch type is ignored.
> This worked in prior versions.
> This has nothing to do with having additional restrictions on the same association, which is a different issue altogether.
> Technical analysis:
> This regression was introduced in git commit fbae6db0abaeb6f050ee97ce53d09d74886a7e47, and the fix for a possibly related issue in git commit 1c556dc775708706b6ca84251cb170d3c46f729f was not a complete fix, or rather did not fix this case scenario.
> The first referenced commit split the JoinWalker.getJoinType(...) api into two methods, one with more parameters.  In the base class implementation, one method or the other is called based on the type of association (see above).  However, in the CriteriaJoinWalker (a subclass), the existing implementation only overrode one of these two methods, (the one with more arguments) causing calls into the other method to be handled by the base class, which did not function appropriately.
> The second referenced commit introduced an override for the second method, however the implementation was incomplete, and was missing the crucial piece, specifically:
> FetchMode fetchMode = translator.getRootCriteria().getFetchMode( path.getFullPath() );
> which examined the explicitly set join types in the translator.
> A fix will be supplied on github for 3.6.x and 4.0.
> The implementation re-unifies the two methods in the CriteriaJoinWalker, using if/else to delegate to the correct super.getJoinType(...) method as appropriate.

--
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