I have two entities, C and P.
C is mapped to P in a one-to-one association, with lazy="no-proxy",
like this: (P's mapping:)

    <one-to-one name="c" class="C" property-ref="P" access="field"
lazy="no-proxy"/>

P is mapped to C in a many-to-one association, like this: (C's
mapping:)

    <many-to-one name="p" column="PId" class="P" access="field"
lazy="no-proxy" not-null="false"/>

usually I use lazy fetching, but in some cases I use FetchMode.Join to
avoid the N+1 SELECTs problem, like this:

    criteria.SetFetchMode("p", FetchMode.Join)

however, using FetchMode.Join for the C entity performs the query
__with__ a left outer join, and then immediately performs N more
queries, fetching P's by ID! (profiling courtesy of NHProf)

any idea why this is happening?

--

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.


Reply via email to