FetchMode just adds an outer join to the query which will result in a
Cartesian project which I definitely don't want.  The SQL that is
generated is exactly what I want.  I have all the fields for every
object in the object graph.  I thought that the RootEntityTransformer
would then populate the entire object graph with actually object and
not proxies, but when I iterate on the a one to many relationship, I
see each object in the graph calling out to sql server.  I shouldn't
need other techniques because the generated SQL returns all the fields
I need.  That's the whole point of writing this query and not just
walking through every object.



On Nov 6, 5:15 pm, Jason Meckley <[email protected]> wrote:
> if you want to select the data you need to set the fetch mode, not the
> join mode. however you may find that loading everything in a single
> query may be sub-optimal. you will end up with a Cartesian result set
> (lot of duplicated data). If that is the case you could try other
> techniques: ado.net batching (this may only apply to writes, not
> reads), multi-queries, sub-select batching, filters. Even though you
> execute multiple remote db calls, the results sets are unique and the
> throughput could increase.
>
> also, if your collections use a List instead of a Set you may get
> duplicate items in the collections. A Set is the only collection that
> ensure uniqueness.
>
> On Nov 6, 4:37 pm, fknebels <[email protected]> wrote:
>
> > I've got a iCriteria query that joins 7 different tables.  The SQL it
> > generates is exactly what I want.  I thought I would be able to
> > populate the entire object tree from this query, but as I iterate over
> > child objects I see queries getting sent to SQL server using NHProf.
> > How do I get this ICriteria to load the entire object tree?  This is
> > the query:
>
> >             return session.CreateCriteria(typeof(MatchRuleGroup))
> >                 .Add(Restrictions.Eq("Name", Name.Trim()))
> >                 .CreateAlias("GroupSets", "groupsSet",
> > NHibernate.SqlCommand.JoinType.InnerJoin)
> >                 .CreateCriteria("groupsSet.RuleSet", "ruleset",
> > NHibernate.SqlCommand.JoinType.InnerJoin)
> >                 .CreateAlias("ruleset.Comparisons", "comparison",
> > NHibernate.SqlCommand.JoinType.InnerJoin)
> >                 .CreateCriteria("comparison.Rule", "rule",
> > NHibernate.SqlCommand.JoinType.InnerJoin)
> >                 .CreateCriteria("rule.Field",
> > NHibernate.SqlCommand.JoinType.InnerJoin)
> >                 .CreateCriteria("rule.Pattern",
> > NHibernate.SqlCommand.JoinType.InnerJoin)
> >                 .SetResultTransformer(new
> > NHibernate.Transform.RootEntityResultTransformer());
>
> > Thanks,
> > Fran
--~--~---------~--~----~------------~-------~--~----~
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