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