0

I've got an application that has the following HQL:

select distinct p from Position p
inner join fetch p.RequiredSkills rs
inner join fetch rs.Skill s
where s.Id in (:skills)

I've searched the positions where the position has the skill searched for.

Currently the hql works as far as returning positions with that skill, but it's only fetching the filtered skills.

I now want to return all of the skills associated to the position.

Is there any way for me to do this?

Cheers,

James

4

1 回答 1

2

You could try using a subquery:

select distinct p from Position p 
inner join fetch p.RequiredSkills rs 
inner join fetch rs.Skill s where p.Id in 
( select distinct pi.Id from Position pi
  inner join pi.RequiredSkills rsi
  inner join rsi.Skill si
  where si.Id in (:skills) )
于 2012-10-18T10:31:29.990 回答