Hi - thanks for the replies. :) I know I am doing a lazy load with the collection. What I want to avoid is the "select n+1" when iterating the collection of B's on A.
As far as I understand it, the setup I am using will lead to select n +1, when doing a foreach on the collection of B's. Please correct me if I am wrong. Most of the time I do not need the collection of Bs, but when I do I want NHibernate to fill the collection completely the first time I begin to iterate the collection. Am I making any sense? Regards Thomas On 14 Mar., 23:46, Fabio Maulo <[email protected]> wrote: > for what ? (specifically)probably you are using <bag> when you would like > use something else. > > 2009/3/14 Thomas Koch <[email protected]> > > > > > > > > > Hi - I have two entities A and B, where A has a bag of B's: > > > class A { > > public IList<B> Bs { get; set; } > > } > > > A.hbm.xml file: > > > <bag name="Bs" inverse="true" cascade="all" lazy="true"> > > <key column="aId" /> > > <one-to-many class="B" /> > > </bag> > > > Is it possible to have NHibernate load all the B instances the first > > time I use the associated IList on A ? > > > Reading the documentation it seems to me that the only way to have > > NHibernate load it all is to use fetch="join" in the mapping file, but > > that would load everything whenever A is loaded, and I do not want > > that. > > > Cheers, > > Thomas > > -- > Fabio Maulo- Skjul tekst i anførselstegn - > > - Vis tekst i anførselstegn - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
