Hi there - I was hoping someone could shed some light on a scalability problem I have with NH?
Legacy system using NH 1, with a large inheritance structure. Essentially there's:
Core layer (where all objects are first defined) Customer layer (where we add in cross product functionality) Product layer (specific product implementations of the objects)
there are currently 17 products - each with their multiple layers of inheritance within themselves.
Example:
CoreUser is implemented by CustomerUser is implemented by ProductAUser (there's also multiple classes in ProductA which inherit from ProductAUser, e.g. ProductAGuestUser, ProductAAdminUser, ProductAReadonlyUser etc)
ProductA has no concept of products b, c and d etc
They all use the same session / session factory (so the mappings for all products have been read in).
There's also another core class (CoreLocation) which implements a .Users property which returns a list of the users associated with that Site. This is also implemented on the various layers. (so - there's a ProductALocation class)
Problem comes here: ProductALocation.Users causes sql to be executed that covers all mappings for all products and layers using outer joins.
Is there some way of implementing some sort of type restriction at the product layer which will restrict the sql that's executed when CoreLocation.Users is called? I know that, for a give product, the types that can be on Product?Location.User list are either CoreUser, CustomerUser or Product?User (and it's implementations) - I dont want to look for B and C and D product users...
This particular problem is causing us MASSIVE performance problems - the queries that are being executed are 5000+ lines long and causing timeouts.
Thanks in advance for any help (even if it's RTFM!) or suggestions as to manual chapters that I should review - surely I cant be the only person on the planet to be getting these problems?
Andy
PS - this is a legacy system which cannot be changed to a vast degree - I didn't sling it together in the first place - I'm just the poor sap that's been tasked with eliminating this particular problem!
|