This may help: http://ayende.com/Blog/archive/2009/04/27/nhibernate-futures.aspx
Without your mappings and query, we really can't tell you more. <http://ayende.com/Blog/archive/2009/04/27/nhibernate-futures.aspx> On Mon, May 10, 2010 at 11:32 AM, Dor Rotman <[email protected]> wrote: > Hello, > Consider this scenario: I need to query for employees, and: > 1. Each employee has a collection of addresses, each address has a > collection of phone numbers. > 2. The query must run as fast as possible, since I'm focusing on the > performance aspect now. > 3. Paging should be supported. > > Right now there are no lazy properties, since all objects will > eventually be serialized via WCF. > So each object returned from the query sends NH to do lots of > roundtrips to the DB, to populate all collections. > > If I do an eager fetch on everything, I get a Cartesian product, and > then need to run the DistinctRootEntityTransformer. As far as I know, > it does not affect the SQL statement, but rather works on the returned > CLR objects. Therefore paging will not work well, because some records > from the returned result set will be ignored. Additionally, it came to > having 5500 rows returned for 270 entities, before running the > transformer. This is due to the Cartesian product. > > How can I optimize the current implementation? Is there any way to > make less DB roundtrips while still being able to page properly? (and > not loading a whole lot of CLR objects to memory?) > > Any assistance would be greatly appreciated. > > Thanks, > Dor Rotman. > > -- > 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.
