[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4893) Multiple Joins using criteria

Tsering Shrestha (JIRA) noreply at atlassian.com
Tue Feb 9 10:36:31 EST 2010


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

Tsering Shrestha commented on HHH-4893:
---------------------------------------

Considering the fact that a Criteria-query is ultimately translated to a SQL query and the latter does support multiple joins, maybe we could start working on that. 

> Multiple Joins using criteria
> -----------------------------
>
>                 Key: HHH-4893
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4893
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: query-criteria
>    Affects Versions: 3.3.2
>            Reporter: praveer gupta
>
> I need to do multiple joins between two tables using Hibernate criteria.
> I tried doing the following:
> Crtieria criteria = session.createCriteria(Cat.class, "cat");
> criteria.createAlias("cat.kittens", "first", CriteriaSpecification.LEFT_JOIN)
> .add( Restrictions.eq("first.name", "Foo"));
> criteria.createAlias("cat.kittens", "second", CriteriaSpecification.LEFT_JOIN)
> .add( Restrictions.eq("second.name", "Bar"));
> criteria.list();
> I get the following: org.hibernate.QueryException: duplicate association path
> I tried looking for issues regarding the same and found http://opensource.atlassian.com/projects/hibernate/browse/HB-555. 
> I am not aware whether we can do multiple joins using criteria now. 

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