[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-890) Multi join SQL querry are not correctly produced

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


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

Steve Ebersole closed HHH-890.
------------------------------


Closing stale resolved issues

> Multi join SQL querry are not correctly produced
> ------------------------------------------------
>
>                 Key: HHH-890
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-890
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>            Reporter: Misko Hevery
>
> I would like to produce a query such as this....
> SELECT c.ID as componentID 
> FROM GEN_COMPONENT as c
>    INNER JOIN GEN_COMPONENT_VALUE v0 ON c.ID=v0.component_id
>    INNER JOIN GEN_COMPONENT_VALUE v1 ON c.ID=v1.component_id 
> WHERE componentKind_id IN (?,?)
>    AND v0.property_id=? AND v0.val=?
>    AND v1.property_id=? AND v1.val=? 
> I would expect that this code would produce the above SQL.
> (pseudo-code)
> Criteria comp = session.createCriteria(Component.class, "c"); 
> Criteria v1 = comp.createCriteria(Component.PROP_VALUES, "v1");
> Criteria v2 = comp.createCriteria(Component.PROP_VALUES, "v2");
> v1.add(Restrictions.eq("property_id", p1);
> v1.add(Restrictions.eq("val", 60);
> v2.add(Restrictions.eq("property_id", p2);
> v2.add(Restrictions.eq("val", 50));
> I have tried many different combinations but i either get a runtime exception or this incorect SQL 
> SELECT c.ID as componentID 
> FROM GEN_COMPONENT as c
>    INNER JOIN GEN_COMPONENT_VALUE v ON c.ID=v.component_id 
> WHERE componentKind_id IN (?,?)
>    AND v.property_id=? AND v.val=?
>    AND v.property_id=? AND v.val=? 
> In either case it is not what I want. As far as I can tell this is not possible... But I might be wrong...

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