[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-3538) Criteria.createAlias/Criteria.createCriteria forces join fetching of association

Gérald Quintana (JIRA) noreply at atlassian.com
Fri May 6 04:08:00 EDT 2011


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

Gérald Quintana commented on HHH-3538:
--------------------------------------

HHH-2049 wasn't a duplicate of this issue, since HHH-2049 was fixed in Hibernate 3.6.4, but HHH-3538 still occurs on same version: Doing 
{code:java}
        Criteria customerCrit = session.createCriteria(Customer.class);
        customerCrit.createCriteria("country").add(eq("name", "France"));
        List<Customer> customers = customerCrit.list();
{code}
still produces a SQL query with Country columns in select:
{code:sql}
select 
        this_.id as id1_1_, this_.country_id as country3_1_1_, 
        this_.name as name1_1_, country1_.id as id0_0_, country1_.name as name0_0_
from Customer this_ 
        inner join Country country1_ on this_.country_id=country1_.id 
where country1_.name=?
{code}

> Criteria.createAlias/Criteria.createCriteria forces join fetching of association
> --------------------------------------------------------------------------------
>
>                 Key: HHH-3538
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3538
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-criteria
>    Affects Versions: 3.2.6, 3.3.1, 3.5.1
>            Reporter: Hauke Rabe
>            Assignee: Gail Badner
>         Attachments: hhh-3538-3.6.1.zip, hhh-3538.zip, hhh-3538b.zip
>
>
> The underlying cause is an invalid assumption made in JoinWalker that every association found in its association member list is to be fetched (added to the select fragment).  

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