Hi Gunnar, I am able to get correct data without duplicates by using your solution with ToFuture(). Thanks for your answer.
Le ven. 1 févr. 2019 à 14:34, Gunnar Liljas <[email protected]> a écrit : > That's "by design", or rather, that's expected due to how things work > right now. You can't fetch multiple collections without getting into > cartesian multiplication issues. > > What you can do is use futures. > > query.FetchMany(p=>p.Books).ToFuture() > > var result=query.FetchMany(p=>p.Articles).ToFuture().ToList() > > /G > > Den fre 1 feb. 2019 kl 03:35 skrev Kavitha <[email protected]>: > > > > I am using Nhibernate version 3.2.0 I need to fetch multiple collections. > > > > public class Person > > { > > public virtual int Id { get; private set; } > > public virtual ICollection Books { get; set; } > > public virtual ICollection Articles { get; set; } > > } > > > > I am using following query to retrieve data > > IList result = (from person in Session.Query() select > person).FetchMany(p => p.Books) .FetchMany(p => p.Articles).ToList(); > > > > But, I get duplicate data in the result for Books & Articles. How can I > retrieve the correct data of Books & Articles of each Person? > > Thank you in advance. > > > > -- > > You received this message because you are subscribed to the Google > Groups "nhusers" group. > > To unsubscribe from this group and stop receiving emails from it, send > an email to [email protected]. > > To post to this group, send email to [email protected]. > > Visit this group at https://groups.google.com/group/nhusers. > > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "nhusers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/nhusers. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
