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 Developer
http://weblogs.asp.net/stefansedich
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---