Thx. It works with query.SetResultTransformer(new
NHibernate.Transform.DistinctRootEntityResultTransformer());


On 4 Maj, 06:19, Markus Zywitza <[email protected]> wrote:
> That's expected, the query uses an outer join, thus yielding 11 rows in the
> result. Please search for DistinctRootEntityResultTransformer and NHibernate
> for details.
> -Markus
>
> 2009/4/30 chitech <[email protected]>
>
>
>
> > Let say I got this code:
>
> > [ActiveRecord]
> > public class Case
> > {
> >        [HasMany(Table="Case_CaseType", ColumnKey="CaseID",
> > Element="CaseTypeID", ElementType = typeof(CaseType))]
> >        public IList<CaseType> CaseTypes
> >        {
> >            get { return caseTypes; }
>
> >            set { caseTypes = value; }
> >        }
> > }
>
> > public enum CaseType
> > {
> >      TYPE1 = 1,
> >      TYPE2 = 2
> > }
>
> > Let say I have 10 cases and 1 of them have 2 casetypes
>
> > When I run this query:
> > SimpleQuery query = new SimpleQuery(typeof(Case), @"from Case c");
> > It's working fine and I get 10 cases back and casetypes is populated.
> > But NHProf saying select N+1
>
> > If I run this:
> > SimpleQuery query = new SimpleQuery(typeof(Case), @"from Case c left
> > joint fetch c.CaseTypes");
> > Now I got 11 cases back and only 1 select statements (the last part is
> > fine)
>
> > It is because NHibernate don't know about CaseType enum?
--~--~---------~--~----~------------~-------~--~----~
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