var users = new HashSet<User>(session.CreateQuery(....).List());
or use a ResultsTrasformer

On Tue, Sep 21, 2010 at 9:00 AM, doggelito <[email protected]>wrote:

> Hi,
> My head is blank right now and can't figure out how to solve this! :(
>
> I have one User entity and it has a collection of Companies like this:
> public class User
> {
>     public int ID { get; private set; }
>     public string UserName { get; set; }
>     public IList<Company> Companies { get; set; }
>     ...
> }
>
> public class Company
> {
>     public int ID { get; private set; }
>     public string CompanyName { get; set; }
>     ...
> }
>
> I want the result in a grid to be like this:
> UserName     CompanyName
> User1            My company
> User1            My second company
> User2            Another company
>
>
> At the moment my select i hql looks like:
> select u from User u left join fetch u.Companies c
>
> It looks fine in SQL Management Studio but when I write out
> user.Companies[0].CompanyName in my grid, each row for "User1" writes
> out "My company".
>
> So, how do I solve this?
>
> --
> 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=en.
>
>


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

Reply via email to