batch-size on Account's collection of Environments? /Oskar
2009/11/17 F.B. ten Kate <[email protected]>: > I posted this problem before but might have overcomplicated the > problem. > > I have a Batch (Mapped to a Batch table) this Batch has a Many-To-Many > relationship with Accounts. Accounts are not mapped back to Batches. > > These accounts have a many-to-many relationship with Environemtns, > environments are not mapped back to accounts. > > Currently when i get a Batch i have the following queries: > > 1 Query to get my batch. > 1 Query to get all the accounts > 1 Query for every account to get it's environments. > > The last line is also known as the N+1 problem, sadly so far i have > been unable to get the last Query to turn itself into one big query > and let NHibernate handle the magic. > > I should not that my mappings might be a bit excentric due to the fact > the batches are going to be returned in a webservice and someone > thought having ArrayOfAccounts isn't a nice object type. So i have a > accounts class which derives from CollectionBase. I then expose the > List property and when setting this List property i loop through the > List set by NHibernate to add it to the IList which is in the > CollectionBase, i haven't been able to simply cast the two. > > Now the selects are a huge peformance problem and i really need to > tackle this problem. I hope i can keep my objects as they currently > are but if i have to mess around with those it isn't to much of a > problem. Anyone with any suggestions? (I am not using Linq to NH, just > plain old NHibernate running on .net 2.0) > > Greetings, > > Folkert > > -- > > 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=. > > > -- 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=.
