from User u where u.UserID in (:myListOfIds)

-Markus

2009/12/1 JakeS <[email protected]>:
> I've had to resort to using SQL for a query to get a list of IDs
> back.  I fought with Criterion and HQL for a long time, and finally
> fell back to this--
>
> var query =
>    @"
>    SELECT     UserSkills.UserID
>    FROM         UserSkills
>    JOIN UserSkillValue on UserSkills.SkillValueID = UserSkillValue.Id
>    WHERE UserSkillValue.SkillID IN
>    (
>        SELECT SkillID FROM ProjectSkills WHERE ProjectID = 1
>    )
>    GROUP BY UserSkills.UserID
>    HAVING COUNT(UserSkillValue.SkillID) = (SELECT COUNT(SkillId) FROM
> ProjectSkills WHERE ProjectID = 1)";
>
> var results = (IList<Int32>)ActiveRecordMediator<User>.Execute(
>   delegate(ISession session, object instance)
>   {
>      return session.CreateSQLQuery(query)
>        .List<Int32>();
>   }, null);
>
> This gives me a list of IDs for users.  But I need to actual users!
> What's the cheapest way of getting users from this?
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Castle Project Users" 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/castle-project-users?hl=en.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en.


Reply via email to