The FetchEnum just specifies how it is loaded, not when. For this you should
set lazy=false for all entities within the aggregate. With FetchEnum, you
just influence the SQL created by NHibernate, which should be irrelevant to
the model.

-Markus

2009/6/17 csharp <[email protected]>

>
> I am doing it this way because I am using DDD principles.  I choose to
> load my entire aggregate root at once, just a personal preference.
>
>
>
>
> On Jun 17, 2:20 am, Markus Zywitza <[email protected]> wrote:
> > To be honest, I'm using AR now for 3 years, but I never specified the
> Fetch
> > property on any of my collections. To me, it smells a bit like premature
> > optimization. If you worry on performance, you should rather be picky
> about
> > when to use lazy loading and when not to use it (n+1). This can be done
> both
> > in HQL and Criteria.
> >
> > As for DetachedCriteria:
> >
> > ActiveRecordMediator<T> has overloads of FindAll, FindFirst and FineOne
> > taking DetachedCriteria.
> > -Markus
> >
> > 2009/6/17 csharp <[email protected]>
> >
> >
> >
> >
> >
> > > I do not want to use HQL as I read that it does not respect the
> > > FetchEnum I specify in the property attributes.
> >
> > > to query an association - random example :
> >
> > > class car
> > >  -engine
> > >  -transmission
> > >  -numberOfWheels
> > >  -etc
> >
> > > class engine
> > >  -number of cylinders
> >
> > > class transmission
> > >  -auto?
> > >  -type
> >
> > > I read that it looks like using detached criteria is the recommended
> > > approach to query properties of the engine object inside the car
> > > object, yet Hibernate's docs say this about detached criteria:
> >
> > > The DetachedCriteria class lets you create a query outside the scope
> > > of a session, and then later execute it using some arbitrary Session.
> >
> > > Also, they have a specific section regarding querying associations:
> >
> > >http://docs.jboss.org/hibernate/stable/core/reference/en/html/querycr.
> ..
> >
> > > Does Castle have a way to query associations using ICriterion?
> >
> > > Alternatively, did i misread that HQL does not respect the FetchEnum I
> > > specify in the property attributes
> >
> > > I don't mind one way or another, just wanted to see what the pros and
> > > cons were. Does HQL introduce any limitations at all?- Hide quoted text
> -
> >
> > - Show quoted text -
>  >
>

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