Can you possibly provide an example? I'm not sure I'm following you. On Jun 23, 5:44 pm, John Davidson <[email protected]> wrote: > The approach I use to do similar tasks is to do a series of simple queries, > where the first query provides an array of fk for the next query and use an > 'In' criteria on the second query. This proceeds for each query in turn > until I have all the data. Then I build a LINQ-for-Objects query based on > the fetch data. > > Domain logic is encapsulated in various lambda equations and they are used > in the LINQ-for-Object query that all runs in memory. The LINQ query then > selects the fields required to fill the DTO that is passed to the grid. > > John Davidson > > > > On Wed, Jun 23, 2010 at 6:05 PM, Mike <[email protected]> wrote: > > I'm trying to figure out how to do complicated queries in NHibernate. > > I'm trying to refactor a Stored Proc that populates a grid to an > > NHibernate query, but I'm having problems because it joins a dozen > > tables. I'm aware of setting FetchModes in NHibernate; however, it > > just seems like it's going to be difficult to recreate the results of > > this query in OO format instead of tabular format. Here's an example > > query: > > > SELECT > > Book.ID, > > Book.Name, > > Author.Name, > > AuthorAddress.State, > > Publisher.Name, > > PublisherAddress.State > > FROM > > Book > > INNER JOIN Author ON (Author.ID = Book.AuthorID) > > INNER JOIN Address AuthorAddress ON (AuthorAddress.ID = > > Author.AddressID) > > INNER JOIN Publisher ON (Publisher.ID = Book.PublisherID) > > INNER JOIN Address PublisherAddress ON (PublisherAddress.ID = > > Publisher.AddressID) > > > Now this is a mocked up example, but you can see the Joins go more > > than one level deep. After I figure in dynamic sorting and paging, > > the Stored Proc yields the exact structure I want to show in my grid. > > I'm having problems replicating this with NHibernate. Any advice out > > there? Should I be taking a different approach? I thought about > > keeping a stored procedure and loading it to a simple DTO for display > > in my grid, but there's domain logic I would love to include in the > > grid, and I'd hate to replicate it. > > > Thanks! > > > -- > > 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.
