Hibernate version: 3.2.6.ga
Hi,
my problem is to write a HQL-query, which finally translates into the following SQL-query:
Code:
    select
        p.name as name,
        cv.mail as mail
    from
        person p 
    left outer join (
           contact c 
       inner join
           contactvalue cv 
               on (c.id=cv.contact_id and 
                   cv.type='email')
    ) on p.id=c.person_id 
The HQL I have (which gets not the correct result!) is:
Code:
   select p.name, cv.mail
   from Person p
        left join p.contact c
        inner join c.contactvalue cv with (cv.type='email')
Hibernate show me an error, if I add a bracket:
Code:
   select p.name, cv.mail
   from Person p
        left join (p.contact c
        inner join c.contactvalue cv with (cv.type='email'))
The relation between Person and Contact is 1..*
Has somebody an idea, how it could work?
I have testet many different HQLs, but nothing works.
It seems, that Hibernate does not support brackets in joins in any form.