views:

276

answers:

0

Hi!

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 */