[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-997) FetchMode.JOIN in Criteria not working as expected

Steve Ebersole (JIRA) noreply at atlassian.com
Mon Mar 21 13:00:48 EDT 2011


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

Steve Ebersole closed HHH-997.
------------------------------


Closing stale resolved issues

> FetchMode.JOIN in Criteria not working as expected
> --------------------------------------------------
>
>                 Key: HHH-997
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-997
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.0.5, 3.1 beta 2
>         Environment: WinXP, JDK 1.4.2, Oracle
>            Reporter: Vladimir Kamba
>   Original Estimate: 20m
>  Remaining Estimate: 20m
>
> I'm trying to create Criteria select and I need to outer join the aliased Class.
> Criteria crit = getSession().createCriteria(Transaction.class).createAlias("accountFrom","accountFrom").setFetchMode("accountFrom", FetchMode.JOIN);
> I expect the code above to generate left outer join statement but it doesn't.
> I tried to inspect the Hibernate source and found the potential bug location:
> Hibernate 3.0.5 - org.hibernate.loader.criteria.CriteriaLoader - method getJoinType
> Hibernate 3.1.b3 - org.hibernate.loader.criteria.CriteriaJoinWalker - method getJoinType
> the first condition in the protected getJoinType(...) method is
> if ( translator.isJoin(path) ) {
>   return JoinFragment.INNER_JOIN;
> }
> else { ...
> WHY???
> Evaluation of my criteria fulfils the condition above and returns the JoinFragment.INNER_JOIN what results in INNER join statement.
> I recomend to change the first condition in the getJoinType method to:
> if ( translator.isJoin(path) ) {
> 			FetchMode fm = translator.getRootCriteria().getFetchMode(path);
> 			if ( fm==FetchMode.JOIN ) {
> 				return getJoinType(nullable, currentDepth);
> 			}
> 			else {
> 				return -1;
> 			}		
> } 
> else ...
> Maybe I'm wrong and there is some other way to fix my criteria. If so then please let me know.
> Thanks
> Vladimir

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