Thanks Fabio. I knew it would be something simple I hadn't discovered yet. I wouldn't say I'm loading up a really complex object graph, just a big one. Everything is one layer deep. I have a lot of child collections, so I end up with a long SQL select statement with a dozen or so joins, which is what I think I want. My result set might be too large, so I may have to rethink this. Either way, Google didn't give me the answer, so I'm going to write about this on my blog.
On Fri, Sep 11, 2009 at 3:51 PM, Fabio Maulo <[email protected]> wrote: > DistinctRootEntityResultTransformer > btw upload a really complex object graph in just only one round trip is > impossible when you are talking with an RDBMS. > > 2009/9/11 Jason Dentler <[email protected]> > > >> I need to display data from an entire object graph which is lazy >> loaded by default (which works well for the rest of the app). I >> *could* do a GetByID for the root and allow lazy loading to get >> everything else, but I'd rather get it all inside my explicit >> transaction in one database round-trip. To accomplish this, I've got >> something like this: >> >> Dim Root As RootType = session.CreateCriteria(Of RootType) >> ().SetFetchMode("bag1", FetchMode.Eager).SetFetchMode(bag2", >> FetchMode.Eager).Add(Expression.Eq("ID", id).UniqueResult(Of RootType) >> >> RootType Root = session.CreateCriteria<RootType>() >> .SetFetchMode("bag1", FetchMode.Eager) >> .SetFetchMode("bag2", FetchMode.Eager) >> .Add(Expression.Eq("ID", id) >> .UniqueResult<RootType>(); >> >> I'm not sure this is the correct way to go about it. The returned root >> object has some weird Cartesian product mess in the child collections >> - multiple instances of the same entity. Any ideas? >> >> I'm sorry I don't have an example with mappings to share right now. If >> I don't get a quick answer, I'll work up an example over the weekend. >> >> > > > -- > Fabio Maulo > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
