Hi, I have a question about collection loading strategy. I am using Criteria like this:
Code:
ICriteria crit = session.CreateCriteria(typ);
... some code here...
list = crit.List();
As I look at MSSQL profiller trace, I see that after executing first query with outer joined objects, it does a a query again for each of the object in the collection (by primary key). When the collection is big, this scenario is quite performance killing.
First I thought that setting all joined objects to outer join and all collections in the main object to lazy solves this problem, but not.
I tried to search this forum for simillar question but I didn't find any. Does anybody have a tip how to disable such behavior?
the mapping document looks like this:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="CID.BusinessObjekty.StavZasob, SkladLib" table="STAV_ZASOB">
<id name="Id" column="lIDStavZbozi" unsaved-value="0">
<generator class="native" />
</id>
<property name="Cislo" column="szCislo"/>
<property name="Zkratka" column="szZkratka"/>
<property name="PocetKusu" column="fKus"/>
<many-to-one name="Zbozi" outer-join="true" column="IDZbozi" property-ref="IdIS" cascade="none" class="CID.BusinessObjekty.SkladoveZbozi, SkladLib" />
<many-to-one name="Exportovano" outer-join="true" column="IDExport" class="CID.BusinessObjekty.Export, SkladLib" />
<many-to-one name="Zakaznik" outer-join="true" column="IDZakaznik" cascade="none" class="CID.BusinessObjekty.Spolecnost, UserLib" />
</class>
</hibernate-mapping>