Hello Guys,

I have been using NHibernate on my project and I have a question here
related with FetchMany and Take. We are using Linq to make the queries. We
are using Oracle database and we are trying to perform this linq query:

var result = Session.Query<Entity>()
                    .FetchMany(x => x.Childs)
                    .OrderByDescending(x => x.Date)
                    .Take(10)
                    .ToList();

The SQL statment executes a query to fetch all Childs on the Entity and
repeat the Entity for each Child. The problem is that I want the last 10
Entity with a fetch on Childs collection but NHibernate generates a SQL to
take the RowNum <= 10, and if any Entity has more then 10 Childs, it just
takes a single Entity and does not return Childs and next 9 Entity.

Is there any way to solve it?

Thank you


-- 
______________________________________
Felipe B Oriani
[email protected]

-- 
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.

Reply via email to