Note that there are some explanatory texts on larger screens.

plurals
  1. POMultiple many-to-one to a single table
    primarykey
    data
    text
    <p>i have a Product table with two many-to-one references (Title &amp; Description) to a single table named TextRef :</p> <p>Product:</p> <pre><code>&lt;many-to-one lazy="false" name="Title" class="TextRef" column="TitleRef" fetch="join" cascade="save-update"/&gt; &lt;many-to-one lazy="false" name="Description" class="TextRef" column="DescriptionRef" fetch="join" cascade="save-update"/&gt; </code></pre> <p>every TextRef has a one-to-many to TextRefItem table :</p> <pre><code>&lt;bag lazy="false" name="Values" table="TextRefItem" cascade="save-update" inverse="true" fetch="join"&gt; &lt;key column="TextId"&gt;&lt;/key&gt; &lt;one-to-many class="TextRefItem"/&gt; &lt;/bag&gt; </code></pre> <p>now i want to load all of TextRefItem(s) for Title &amp; Description in one go but NHibernate only create a join with the first reference (Title)</p> <pre><code>SELECT this_.ProductId as ProductId7_2_, this_.CategoryId as CategoryId7_2_, this_.DescriptionRef as Descript3_7_2_, textref2_.TextId as TextId8_0_, values3_.TextId as TextId4_, values3_.TextItemId as TextItemId4_, values3_.TextItemId as TextItemId9_1_,values3_.LangId as LangId9_1_, values3_.Text as Text9_1_, values3_.TextId as TextId9_1_ FROM Product this_ inner join TextRef textref2_ on this_.DescriptionRef=textref2_.TextId left outer join TextRefItem values3_ on textref2_.TextId=values3_.TextId WHERE this_.ProductId = 1 </code></pre> <p>for the other one(Description) it makes a separate select query </p> <p>how could i tell NHibernate to avoid that ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload