Hi,
If I have a company/employee relation, how can I fetch all
company which have female employees with name "Miller" AND male employees with name "Smith"?
My first (almost successful) attempt was to use a subquery, but I would also get companies with male Millers.
HQL:
Code:
select c from Company as c
left join c.employee as e
where e in
(select e from Employees as e
where (e.gender=1 and e.name='Smith')
or (e.gender=2 and e.name='Miller') )
If there was a way to use more than one "e", I could do something like e1, e2 and associate them with "and" instead, but if I try to do so, I get an error (it's not possible to select a property more than once).