[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2049) LEFT OUTER JOIN subcriteria filters children

Martin Wursthorn (JIRA) noreply at atlassian.com
Fri Oct 2 08:36:04 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2049?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=34095#action_34095 ] 

Martin Wursthorn commented on HHH-2049:
---------------------------------------

This is still an issue in 3.3.2 and 3.5.0-Beta1.

We have a criteria query involving inner and outer joins. The generated SQL contains duplicate alias names for two columns which are primary keys of associated collections. When Hibernate tries to initialize the second collection, it tries to find the corresponding key in the resultset from the alias. Due to the duplication it gets the wrong one and consequently the resulting set is not correct.

The first association is an inner join, the second an outer join. Hibernate keeps track  of consumed collection suffixes distinguishing between inner and outer joins in method "selectString"  of org.hibernate.loader.JoinWalker. This fits together with the observations of Mattias Jiderhamn.  

> LEFT OUTER JOIN subcriteria filters children
> --------------------------------------------
>
>                 Key: HHH-2049
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2049
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-criteria
>    Affects Versions: 3.1.3, 3.2.0.cr4
>         Environment: Hibernate 3.1.3/3.2.0rc4, hsqldb 1.8
>            Reporter: Mattias Jiderhamn
>         Attachments: SubCriteriaTestCase.zip
>
>
> When using the Criteria API with LEFT OUTER JOIN to add criterias to the children, i.e.
>   criteria.createCriteria("children", JoinFragment.LEFT_OUTER_JOIN)
> the child collections will only contain those children matching the criteria. (Even when *not* using any Filters).
> The attached testcase (also found here: http://forum.hibernate.org/viewtopic.php?p=2320786) will explain it in more detail.

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