That worked to find all projects a User is qualified for, but now I
need to do the reverse-- find all Users qualified for a project.  And
I've been fighting with the logic on doing this for hours now before I
finally decided to give up and ask for help.

A user may have multiple skills, and a project may require multiple
skills.  I want a list of all users that have all the skills required
by a project.  So if a project requires skill1 and skill3, I could get
a user that has skill1,skill2, and skill3.  Again, I tried using
Criterion (Restrinctions.In()), but that doesn't look like it'll be
powerful enough to get me to where I need to go.

If only there were a "ContainsAll" restriction...

On Nov 27, 12:57 pm, JakeS <[email protected]> wrote:
> That was a great help.  Thank you!
>
> On Nov 27, 4:07 am, Oskar Berggren <[email protected]> wrote:
>
>
>
> > 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/27JakeS<[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 
> > > athttp://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.


Reply via email to