Good news, sort of. I tracked down the cause to the use of stateless session (I get 1 result instead of 4 using the regular session). Is there a reason not to do the same transformation in the stateless session that's done in the regular session?
Should I submit to JIRA? Thanks! -Michael On Jun 2, 9:52 am, Michael Teper <[email protected]> wrote: > This would be the QueryOver equivalent of my LINQ, right? I get the > same result as described earlier: > > var operations = session > .QueryOver<Operation>() > .OrderBy(o => o.DateCreated).Asc > .Fetch(o => o.Steps).Eager > > .TransformUsing(Transformers.DistinctRootEntity) > .List<Operation>(); > > -Michael > > On May 31, 11:27 am, CSharper <[email protected]> wrote: > > > > > Anyway I would say this is a bug. Don't you? > > > On 29 Mai, 18:43, Mohamed Meligy <[email protected]> wrote: > > > > If by Cartesian product you mean the join, then yes, this is how > > > NHibernate > > > do it. > > > > Is there a way to change that? Not in NHibenate stuff. > > > I do it (actually been experimenting this for a few days) by making the > > > collection property settable, having two future queries (calling > > > .ToFututre() on LINQ query or Future() on QueryOVer query) one for parent > > > and another for child, then mapping the child entities to parent manually > > > in > > > a loop. > > > > If you are worried about multiple fetch paths, then you should do one > > > query > > > per fetch path, this will make a cartisian product for the parent entity > > > and > > > child path in the query only. which is better than getting cartestian > > > product of all paths at the same time. You'll not need to map the child > > > paths from different queries to the parent as, since parent is already > > > returned in each queries, and NH keeps only one instance of each object, > > > the > > > parent from any of the queries will already have all child collections > > > populated from different queries loaded into it. > > > > If you try to load the children only without the parent though, it will > > > not > > > map them to the parent coming from other queries then. Because it only > > > does > > > that when the return of the query requires creating new instance of the > > > parent (or reusing existing if already there from another query). > > > > *Mohamed Meligy > > > *Readify | Senior Developer > > > > M:+61 451 835006 | W: readify.net > > > [image: Description: Description: Description: Description: > > > rss_16]<http://gurustop.net> > > > [image: Description: Description: Description: Description: > > > cid:[email protected]] > > > <http://www.linkedin.com/in/meligy> [image: > > > Description: Description: Description: Description: > > > cid:[email protected]] <http://twitter.com/meligy> > > > <http://www.greatplacetowork.com.au/best/best-companies-australia.php><http://www.readify.net/AboutUs/NewsItem.aspx?id=10> > > > > On Mon, May 30, 2011 at 1:35 AM, Ricardo Peres <[email protected]> wrote: > > > > Can you sent your mappings? Using a set should have done it, it is a > > > > known issue. > > > > > On May 29, 7:37 am, Michael Teper <[email protected]> wrote: > > > > > I have tried with both a set and a bag, no difference. How do you > > > > > apply a transformer to a LINQ query? > > > > > > -Michael > > > > > > On May 27, 2:11 am, Ricardo Peres <[email protected]> wrote: > > > > > > > I think that's because you are using a bag. Try using a set instead, > > > > > > it is a little change. > > > > > > Otherwise, you will have to use the DistinctRootTransformer. > > > > > > > RP > > > > > > > On May 27, 9:22 am, Michael Teper <[email protected]> wrote: > > > > > > > > Except that I don't. I end up with *four* operations, *each* with > > > > four > > > > > > > steps. > > > > > > > > -Michael > > > > > > > > On May 26, 7:39 pm, Darren Kopp <[email protected]> wrote: > > > > > > > > > That is working correctly. Since you want to load all of the > > > > > > > > child > > > > items, > > > > > > > > you are getting all the child items, and you also have the data > > > > > > > > for > > > > the > > > > > > > > parent entity. nhibernate will rehydrate it into the correct > > > > > > > > form > > > > so that > > > > > > > > you'll have 1 operation with 4 steps using 1 query.- Hide quoted > > > > text - > > > > > > > - Show quoted text - > > > > > -- > > > > 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.-Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - -- 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.
