c# - NHibernate fetch creates right query and then performs N+1 -


i have 3 entities, configured as

contact   hasone(e => e.user).propertyref(e => e.contact).cascade.all();  user   hasmany(e => e.requests);   references(e => e.contact);  request   references(e => e.user); 

and query this:

  currentsession.query<request>()                 .fetch(x => x.user)                 .thenfetch(x => x.contact)                 .tolist(); 

and looks fetch working, because in first select see tables joined (omitted other fields brevity):

select request0_.id                 id128_0_,    user1_.id                       id131_1_,    contact2_.id                    id77_2_,   requests request0_    left outer join users user1_      on request0_.user_id = user1_.id    left outer join contacts contact2_      on user1_.contact_id = contact2_.id 

and follow n+1 selects reason, can't understand , have no ideas how troubleshoot issue:

select user0_.id                id131_0_,   users user0_  user0_.contact_id = 200 /* @p0 - contact_id */ 

currently bug in nhibernate.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -