第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

如何在NHibernate中不重復(fù)加載關(guān)聯(lián)?

如何在NHibernate中不重復(fù)加載關(guān)聯(lián)?

如何在NHibernate中不重復(fù)加載關(guān)聯(lián)?我需要加載一個(gè)非常大的對象的列表,里面有這么多的孩子和孩子。最好的辦法是什么?我使用的是Oracle 11g數(shù)據(jù)庫,我編寫了以下方法,但結(jié)果是笛卡兒產(chǎn)品(復(fù)制的結(jié)果): public IList<ARNomination> GetByEventId(long eventId)         {             var session = this._sessionFactory.Session;             var nominationQuery = session.Query<ARNomination>().Where(n => n.Event.Id == eventId);             using (var trans = session.Transaction)             {                 trans.Begin();                 // this will load the Contacts in one statement                 nominationQuery                    .FetchMany(n => n.Contacts)                     .ToFuture();                 // this will load the CustomAttributes in one statement                 nominationQuery                    .FetchMany(n => n.CustomAttributes)                     .ToFuture();                 // this will load the nominations but joins those two tables in one statement which results in cartesian product                 nominationQuery                    .FetchMany(n => n.CustomAttributes)                     .FetchMany(n => n.Contacts)                     .ToFuture();                 trans.Commit();             }             return nominationQuery.ToList();         }
查看完整描述

2 回答

?
開心每一天1111

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超13個(gè)贊

只要你急于加載多個(gè)集合,那么笛卡爾產(chǎn)品就會(huì)出現(xiàn)。為了選擇合適的批次大小,我可能會(huì)選擇與page size因?yàn)楦杏X很好.。(但沒有證據(jù))

然而,無論你走哪條路,我建議你向結(jié)果扔一個(gè)分析器,看看哪個(gè)對你有更好的效果.


查看完整回答
反對 回復(fù) 2019-06-29
  • 2 回答
  • 0 關(guān)注
  • 560 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)