What are your mappings? And what does this have to do with cascading? Wild guess: you've set everything as lazy="false".
Diego On Thu, Jun 10, 2010 at 16:41, tqwhite <[email protected]> wrote: > I cannot control the cascade depth. No matter what I do, NH retrieves > the entire object graph and all associations. It stops at some level > (there is recursion otherwise) though the data is too big and complex > for me to analyze exactly where. > > I am presently trying to set the depth to zero (I also tried one) in > an attempt to get something recognizable to happen. It is not working. > Can you see what I am doing wrong? > > This method looks up the root object: > > public virtual LEAInfo getFirst() > { > Orm.startSession(); > > var dbResult = (from testList > in Orm.session.Linq<LEAInfo>() > select testList) > .Skip(0) > .Take(1); > > LEAInfo outObj = dbResult.First<LEAInfo>(); > return outObj; > } > > Orm.startSession creates a static session. It works just like I expect > it to when I am saving things. Note the use of max_fetch_depth: > > public static ISession startSession(){ > if (HttpContextAccess.getSessionVariable("session") == > null) > { > Configuration config = new > NHibernate.Cfg.Configuration() > .SetProperty("max_fetch_depth", "0"); > config.Configure(); > ISessionFactory sessionFactory = > config.BuildSessionFactory(); > ISession newSession = sessionFactory.OpenSession(); > HttpContextAccess.addSessionVariable("session", > newSession); > } > return > (ISession)HttpContextAccess.getSessionVariable("session"); > } > > Thanks for your help. > > tqii > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- 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.
