I am experiencing something weird when using NHibernate. I have opened up a codebase that I didn't write, and the one who did isn't here anymore. So I guess what I am looking for is more tips on debugging than anything else.
I am using NHIbernate 3.4 Linq provider, to query an entity, that has a many-to-one relationship to another entity.
What I see is the even though I never access the property that represents the many-to-one relation it is always hydrated. From looking at the queries through the NHibernate profiler, I can see that the property seems to be lazy loaded. Setting breakpoints with my debugger I can see that the property is never accessed.
When using the NHibernate profiler, I can see that it happens when I load the parent entity list, but not in the same query.
I have no idea why this happens, but it results in a N+1 problem.
The entities are defined in hbm.xml files.
So what I am asking for is input to where I should start digging. I feel that I have tried everything that I can think of already.