3
我有兩個多到一個引用(標題&說明)到名爲TEXTREF單表產品表:多個多到一個單個表
產品:
<many-to-one lazy="false" name="Title" class="TextRef" column="TitleRef" fetch="join" cascade="save-update"/>
<many-to-one lazy="false" name="Description" class="TextRef" column="DescriptionRef" fetch="join" cascade="save-update"/>
每TEXTREF有一個一對多到TextRefItem表:
<bag lazy="false" name="Values" table="TextRefItem" cascade="save-update" inverse="true" fetch="join">
<key column="TextId"></key>
<one-to-many class="TextRefItem"/>
</bag>
現在我想加載所有TextRefItem(S)爲標題一氣呵成&說明,但僅NHibernate的CRE吃了第一基準(標題)
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
的另一個(說明)它使一個單獨的選擇查詢
我怎麼能告訴NHibernate的,以避免加入?
謝謝,我想使這個默認的行爲,但似乎這是不可能通過使用映射文件 – sos00 2011-03-20 22:58:23