0
是否可以在不觸摸映射的情況下使用HQL進行急切加載? nHibernate完全忽略了「left join fetch」表達式。急於使用HQL加載
var query = Session.CreateQuery("from o in Member left join fetch o.Photos");
query.List<Member>();
生成的SQL是
SELECT this_.Id as Id7_1_, this_.Name as Name7_1_, this_.AltNames as AltNames7_1_,
this_.Tags as Tags7_1_, this_.Loved as Loved7_1_, profile2_.id as id6_0_,
profile2_.Website as Website6_0_, profile2_.Email as Email6_0_,
profile2_.Shop as Shop6_0_
FROM Member this_
left outer join member_profile profile2_ on this_.Id=profile2_.id
limit 10;
然後10語句抓取照片。 MemberProfile被映射爲OneToOne。
它完全忽略了「連接抓取」部分。 – 2010-03-28 11:48:22
你能提供更多的上下文並顯示你的代碼嗎? – 2010-03-28 11:49:42
一個左連接怎麼樣:從貓那裏離開貓加入cat.Kittens? – 2010-03-28 11:53:38