NHibernate:批量大小是否有 10 个项目的限制?
我在 NHibernate(SQL Server 2000,如果有的话)方面遇到了问题。
即使我指定 500,NHibernate 也使用等于 10 的批量大小(但如果我指定小于 10 的大小,比如 3 - 它使用 3),
<bag name="RiskTypes" table="CalculationQuery" lazy="false" batch-size="50">
<key column="CalculationID"></key>
<many-to-many class="RiskType" column="RiskType"></many-to-many>
</bag>
我正在加载 11 个项目,并在 NProf 中看到它执行两个查询:
SELECT risktypes0_.CalculationID as Calculat1_1_, risktypes0_.RiskType as RiskType1_, risktype1_.RiskTypeID as RiskTypeID5_0_, risktype1_.RiskTypeName as RiskType2_5_0_ FROM CalculationQuery risktypes0_ left outer join RiskType risktype1_ on risktypes0_.RiskType = risktype1_.RiskTypeID WHERE risktypes0_.CalculationID in (373 /* @p0 */,363 /* @p1 */,364 /* @p2 */,365 /* @p3 */, 366 /* @p4 */,367 /* @p5 */,368 /* @p6 */,369 /* @p7 */, 370 /* @p8 */,371 /* @p9 */)
SELECT risktypes0_.CalculationID as Calculat1_1_, risktypes0_.RiskType as RiskType1_, risktype1_.RiskTypeID as RiskTypeID5_0_, risktype1_.RiskTypeName as RiskType2_5_0_ FROM CalculationQuery risktypes0_ left outer join RiskType risktype1_ on risktypes0_.RiskType = risktype1_.RiskTypeID WHERE risktypes0_.CalculationID = 372 /* @p0 */
I am having a problem with NHibernate (SQL Server 2000, if it matters).
It seems like NHibernate uses batch-size equal to 10 even if I specify 500 (but if I specify size less than 10, say 3 - it uses 3)
<bag name="RiskTypes" table="CalculationQuery" lazy="false" batch-size="50">
<key column="CalculationID"></key>
<many-to-many class="RiskType" column="RiskType"></many-to-many>
</bag>
I am loading 11 items and see in NHProf that it executes two queries:
SELECT risktypes0_.CalculationID as Calculat1_1_, risktypes0_.RiskType as RiskType1_, risktype1_.RiskTypeID as RiskTypeID5_0_, risktype1_.RiskTypeName as RiskType2_5_0_ FROM CalculationQuery risktypes0_ left outer join RiskType risktype1_ on risktypes0_.RiskType = risktype1_.RiskTypeID WHERE risktypes0_.CalculationID in (373 /* @p0 */,363 /* @p1 */,364 /* @p2 */,365 /* @p3 */, 366 /* @p4 */,367 /* @p5 */,368 /* @p6 */,369 /* @p7 */, 370 /* @p8 */,371 /* @p9 */)
SELECT risktypes0_.CalculationID as Calculat1_1_, risktypes0_.RiskType as RiskType1_, risktype1_.RiskTypeID as RiskTypeID5_0_, risktype1_.RiskTypeName as RiskType2_5_0_ FROM CalculationQuery risktypes0_ left outer join RiskType risktype1_ on risktypes0_.RiskType = risktype1_.RiskTypeID WHERE risktypes0_.CalculationID = 372 /* @p0 */
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论