I have now created a Jira issue for this bug: http://216.121.112.228/browse/NH-2534
On Jan 27, 9:33 am, cremor <[email protected]> wrote: > I'm currently having a select n+1 problem although I have mapped the > many-to-one with fetch="join" and I'm using the .Fetch() method in my > LINQ-query. All columns of the related table are already fetched in > the select statement containing the join, however all related entities > are still fetched one by one after that joined select. > > All other of my many-to-one mappings with fetch="join" work without > problem, but they don't use the property-ref attribute (so they > reference the ID column). > > Could this be a bug in NHibernate (I'm using NHibernate-3.0.0.GA) or > am I doing something wrong? > > My mapping (created by FluentNHibernate, I simplified it a bit): > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default- > access="property" auto-import="true" default-cascade="none" default- > lazy="false"> > <class xmlns="urn:nhibernate-mapping-2.2" dynamic-insert="false" > dynamic-update="false" mutable="true" optimistic-lock="version" > name="Konto" table="KONTEN"> > <id name="Id" type="System.Int64"> > <column name="SKO_ID" /> > <generator class="sequence"> > <param name="sequence">SEQ_KONTEN</param> > </generator> > </id> > <version name="Version" type="System.Int64"> > <column name="VERSION" /> > </version> > [Some Properties here] > <many-to-one class="Bank" fetch="join" name="Bank" property- > ref="BLZ"> > <column name="BLZ" /> > </many-to-one> > </class> > </hibernate-mapping> > > <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default- > access="property" auto-import="true" default-cascade="none" default- > lazy="false"> > <class xmlns="urn:nhibernate-mapping-2.2" dynamic-insert="false" > dynamic-update="false" mutable="true" optimistic-lock="version" > name="Bank" table="BANKEN"> > <id name="Id" type="System.Int64"> > <column name="BAN_ID" /> > <generator class="sequence"> > <param name="sequence">SEQ_BANKEN</param> > </generator> > </id> > <version name="Version" type="System.Int64"> > <column name="VERSION" /> > </version> > <property name="BLZ" type="System.String"> > <column name="BLZ_CODE" /> > </property> > [Some Properties here] > </class> > </hibernate-mapping> -- 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.
