Maybe there are better solutions, but you can try this hql:
select proj from Project proj
where proj.id not in (select distinct p.id
from Project p
left join p.RequiredSkills as skill
where skill.id not in (:users_skills) )
/Oskar
2009/11/27 JakeS <[email protected]>:
> I have three entities -- Users, Projects, and Skills. A User may have
> multiple Skills and a Project may require multiple skills. Now I need
> a way to find all Projects that a particular User is qualified to
> perform.
>
> So if User1 knows carpentry, plumbing, and electric, and Project1
> requires carpentry and electric, my query with User1 as the parameter
> would return Project1 as a result.
>
> Unfortunately, my SQL skills are poor at best so I'm struggling with
> HQL. The best I could come up with is:
>
> SimpleQuery<Project>("from Project p where ? in elements
> (p.ProjectSkills)", userSkillIDs)
>
> But this is backward, it'll tell me any projects that have all the
> user's skills, not projects where the user has all the projectskills
> (and maybe more). If I reverse it:
>
> SimpleQuery<Project>("from Project p where (p.ProjectSkills) in
> elements ?", userSkillIDs)
>
> That doesn't work either, I get a
> Antlr.Runtime.MismatchedTokenException.
>
> Can someone point me in the right direction?
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.