If setting lazy=false, for all graph, you have exactly what you want using
reflection and NHibernate.NHibernateUtil.Initialize(object) you have the
same result in terms of SQL quantities.

2008/10/2 alunharford <[EMAIL PROTECTED]>

>
> I don't think I'm explaining myself well. Sorry.
>
> If I turn off lazy loading in my Castle ActiveRecord attributes, I get
> the behaviour I want. Unfortunately, that means I get it for normal
> queries too, and that's bad. I'm wondering how to get that behaviour
> for a single query...
>
> On Oct 2, 3:24 pm, Roger Kratz <[EMAIL PROTECTED]> wrote:
> > IMHO if you want to eager load hole aggregates, it's hard do it some
> generic way. Even if you do traverse the graph one way or the other to set
> setfetchmode for every child object in the aggregate, that's maybe not want
> you want - especially if the aggregate contains more than just a few
> objects/collections. You may need to do it multiple queries (or
> MultiQ/MultiC) to avoid Cartesian products.
> >
> > -----Original Message-----
> > From: [email protected] [mailto:[EMAIL PROTECTED] On
> Behalf Of alunharford
> > Sent: den 2 oktober 2008 16:00
> > To: nhusers
> > Subject: [nhusers] Re: SetFetchMode on all associations for a single
> query?
> >
> > Ah. The reason I'm doing this is to prevent lots of database queries
> > and improve performance, so I'm not sure that helps me...
> >
> > On Oct 2, 2:49 pm, "Fabio Maulo" <[EMAIL PROTECTED]> wrote:
> > > For a reusable solution you must use reflection
> > > and NHibernate.NHibernateUtil.Initialize(object) for each property of
> your
> > > graph.If it is for a DTO is better to create an appropriate DTO class
> and
> > > initialize the instance as needed.
> >
> > > 2008/10/2 alunharford <[EMAIL PROTECTED]>
> >
> > > > Generally I want to lazy load, but I want to eager load everything
> for
> > > > a single query if the client tells me to do that.
> >
> > > > Alun Harford
> >
> > > > On Oct 2, 1:50 pm, "Fabio Maulo" <[EMAIL PROTECTED]> wrote:
> > > > > Always or for a specific use-case ?
> >
> > > > > 2008/10/2 alunharford <[EMAIL PROTECTED]>
> > > > > > Hello all,
> >
> > > > > > In my application I am normally in a position to explicitly state
> > > > > > collections that I want eager loaded, so all all my collections
> are
> > > > > > configured to be lazy loaded. I then use SetFetchMode when I want
> a
> > > > > > collection to be eager loaded.
> >
> > > > > > However, I have now come into a situation where I want to eager
> load
> > > > > > complete object graph(s).
> >
> > > > > > Is there a way I can set fetchmode to join 'globally' on a
> > > > > > DetachedCriteria instance?
> >
> > > > > > Many thanks for any help,
> >
> > > > > > Alun Harford
> >
> > > > > --
> > > > > Fabio Maulo
> >
> > > --
> > > Fabio Maulo
> >
>


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