I'm trying to optimize my queries to DB. Currently we have mapping like this, but it may grow in a future. We are doing a lot of small operations to the object A, and most of them doesn't require to load all data. At the same time for showing data on UI we need to load all staff at once.
I was trying to add extra mapping, but looks like this is not a case here.
Here is mapping file:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-access="property" default-lazy="false">
<class name="A" table="A" discriminator-value="?" dynamic-update="true" >
<cache usage="nonstrict-read-write"/>
<id name="AId" column="aId">
<generator class="guid.comb" />
</id>
<bag name="B" table="B" inverse="true" outer-join="false" lazy="false" batch-size="50" >
<cache usage="nonstrict-read-write"/>
<key column="aId" />
<one-to-many class="B" />
</bag>
<many-to-one name="C" column="cId" class="C" outer-join="true" not-found="ignore" />
<many-to-one name="D" column="dId" class="D" outer-join="true" not-found="ignore" />
</class>
</hibernate-mapping>
Is it possible to specify in ICriteria, that would retrieve just pain object A, or object A with any set internal objects B, C or D
Thanks.