select i from Item i ....

2009/11/15 Sosh <[email protected]>

> Hi,
>
> I'm still v new to NHibernate, and many concepts are still not at all
> natural to me. I have a particular situation which is causing me much
> frustration.  I have 3 entities:
>
> User, Item, and UserRating
>
> UserRating holds a reference to both User and Item, and contains an
> integter 'rating';
>
> Item Holds a collection of UserRatings
>
> User Holds a collection of UserRatings
>
> I currently struggling to understand the best way of query NHibernate
> so that it will bring me, for one particular User, a list of all item
> objects, ordered by the userrating 'rating'.  There may be items that
> the user has not scored (hence there is no UserRating linking them),
> but I would like these to be included with the 0 ratings.
>
> How do I best go about this?
>
> I tried things like: "from Item i left join i.UserRatings r with
> r.User.UserId = :userId" for a start, but this was bringing back an
> array with items in the first element and userratings in the second,
> which is not exactly what I had in mind.
>
> At the core of the problem is how best to deal with results that
> relate only to the current user, and ignore everything else - perhaps
> there is a better way to do this.
>
> If you need more information please let me know  - thanks in advance
> for your help
>
> S
>
> --
>
> 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]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=.
>
>
>


-- 
Fabio Maulo

--

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=.


Reply via email to