if you're using NHibernate 3.1+, then you can use QueryOver:
Session.QueryOver<GroupDTO>()
.Where(x => x.IsActive == true)
.JoinQueryOver<MemberDTO>(x => x.Members,
NHibernate.SqlCommand.JoinType.InnerJoin) //or left join
.Where(x => x.Id != null)
.TransformUsing(Transformers.DistinctRootEntity)
.Future<GroupDTO>();
2011/12/16 mynkow <[email protected]>
> The same query with HQL has still property Members which is not
> initialized:
>
> Session
> .CreateQuery(@" select gr, member from GroupDto
> as gr inner join fetch Members as
> member where IsActive = true and
> member.Id != null ")
>
> .SetResultTransformer(Transformers.DistinctRootEntity)
> .Future<GroupDto>();
>
> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/nhusers/-/uzulAPuJXxAJ.
>
> 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.
>
--
Itzik Saban
my blog <http://itziksaban.blogspot.com/>
--
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.