I think you are trying to lazy load your detail collection...if that's
the case, then just remove the lazy="false" from your mapping  and
SetFetchMode from your criteria query...the default behavior is lazy
loading unless you override it.

On Mar 30, 7:44 pm, Kaltz1974 <[email protected]> wrote:
> Hi!
>
> Sorry for the mistyping... In CreateCriteria clause I have Master
> class indeed.
>
> But my query keeps loading my details...
>
> Any idea or suggestion?
>
> Kaltz1974
>
> On 31 Mar, 01:32, Stefan Sedich <[email protected]> wrote:
>
> > The query seems odd try:
>
> >  NHibernate.ICriteria aCrit;
> >        aCrit = mySession.CreateCriteria(TypeOf(HTestModel.Master));
> > <----- MASTER HERE NOT DETAILS
> >        aCrit.SetFetchMode("Details", NHibernate.FetchMode.Lazy);
> >        .....
> >        sMaster = aCrit.List<MyModel.Master>();
>
> > Unless I have missed something in the brief look I had, let me know.
>
> > Cheers
> > Stefan
>
> > On Tue, Mar 31, 2009 at 9:25 AM, Kaltz1974 <[email protected]> wrote:
>
> > > Hi!
>
> > > I'm in need for help for a probably stupid question but I've trying
> > > all day and I can't get out of it... pleas help me...
>
> > > I'm in a Master - Detail scenario.
>
> > > My master entity has a detail bag where lazy property is set to FALSE
> > > (I should always load details...)
>
> > > I'm traying to shut down programmatically the eager loading of the
> > > collection during a particoular query but Nhibernate seems to ignore
> > > my code...
>
> > > This is my mapping:
> > >    <bag name="Details" table="Detail" lazy="false" generic="true"
> > > fetch="select">
> > >      <key column="IDMaster" />
> > >      <one-to-many class="Detail" />
> > >    </bag>
>
> > > I've got a code like this:
>
> > >        NHibernate.ICriteria aCrit;
> > >        aCrit = mySession.CreateCriteria(TypeOf(HTestModel.Details));
> > >        aCrit.SetFetchMode("Details", NHibernate.FetchMode.Lazy);
> > >        .....
> > >        sMaster = aCrit.List<MyModel.Master>();
>
> > > The details on sMaster are loaded despite the I'm trying to set the
> > > lazy loading on.
>
> > > I don't now what I'm missing.
>
> > > Am I missing some sort of configuration on web.config?
>
> > > Thank you in advance.
>
> > > Kaltz1974
>
> > --
> > Stefan Sedich
> > Software Developerhttp://weblogs.asp.net/stefansedich-Nascondi testo citato
>
> > - Mostra testo citato -
--~--~---------~--~----~------------~-------~--~----~
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