Hi folks! I'm using NHibernate v2.0.50727 and I'm quite uncertain about many-to- one and lazy loading, although I've read several blogs about this topic.
I've got following scenario: Class A has a one-to-many relation to class B (bag collection) and B has got a many-to-one relation to class C. Class A an B do have some other many-to-one relations to other classes (lets say Relation R1 and Relation R2) which are not important for my query. Class A (1)--->(n) Class B (n) ---> (1) Class C Default is lazy=true, but I'm creating my criteria with an left outer join to the classes, so I only need one query for this case. I can see the correct query in my logs. This query returns a collection of records. I can test this query in my sql-client and everything is fine. So far so good. But: For _each_ of my records nhibernate sends additional queries to the database. And it seems that it queries for the related objects which are related to class A and B by many-to-one relations (Relation R1 and R2). This additional references are completely unnecessary in this case and they are not used in this part of the application. My question: Why is nhibernate quering for these additional objects although nobody uses them? I've tried several different options in my many-to-one relations like outer-join="false" lazy="proxy" (I suppose I'm not aware of the effect) fetch="select"/fetch="join" I've added lazy="false" to all classes. How can I prevent nhibernate to load these not needed objects? It has quite an impact on my performance level. Thanks in advance! Fred F. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
