how does one pre-fetch a collection of items' sub properties?
Query:
from prf_ProfileSection as s
join fetch s.ProfileItemTitles
join fetch s.ProfileItemTitles.ItemAdapter
Mappings:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="LightsCore.prf_ItemAdapter, LT.Profiles.Data" table="prf.ItemAdapter">
<id name="Id" type="Int32" unsaved-value="null">
<column name="ItemAdapterID" length="4" sql-type="int" not-null="true" unique="true" index="PK_ItemTitleAdapter"/>
<generator class="native" />
</id>
<property name="AdapterName" type="String">
<column name="AdapterName" length="50" sql-type="varchar" not-null="true"/>
</property>
<property name="DataAdapterTypeName" type="String">
<column name="DataAdapterTypeName" length="255" sql-type="varchar" not-null="false"/>
</property>
<property name="PresenterTypeName" type="String">
<column name="PresenterTypeName" length="255" sql-type="varchar" not-null="false"/>
</property>
<property name="TableName" type="String">
<column name="TableName" length="255" sql-type="varchar" not-null="false"/>
</property>
<!-- many-to-one foreign key relationships -->
<!-- end of many-to-one foreign keys -->
<!--<bag name="StdProfileItemTitles" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="ItemAdapterID"/>
<one-to-many class="LightsCore.prf_StdProfileItemTitle, LightsTogether.Profiles.Data"/>
</bag>-->
<!--<bag name="ProfileItemTitles" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="ItemAdapterID" />
<one-to-many class="LightsCore.prf_ProfileItemTitle, LightsTogether.Profiles.Data"/>
</bag>-->
</class>
<class name="LightsCore.prf_ProfileItemTitle, LT.Profiles.Data" table="prf.ProfileItemTitle">
<id name="Id" type="Int32" unsaved-value="null">
<column name="TitleID" length="4" sql-type="int" not-null="true" unique="true" index="PK_MemberProfileArea"/>
<generator class="native" />
</id>
<property name="TitleName" type="String">
<column name="TitleName" length="50" sql-type="varchar" not-null="true"/>
</property>
<property name="TitleLabelId" type="Int32">
<column name="Title_LabelId" length="4" sql-type="int" not-null="false"/>
</property>
<property name="DescriptionLabelId" type="Int32">
<column name="Description_LabelId" length="4" sql-type="int" not-null="false"/>
</property>
<property name="IsEnable" type="Boolean">
<column name="IsEnable" length="1" sql-type="bit" not-null="true"/>
</property>
<property name="EditOn" type="DateTime">
<column name="EditOn" length="4" sql-type="smalldatetime" not-null="true"/>
</property>
<property name="AddOn" type="DateTime">
<column name="AddOn" length="4" sql-type="smalldatetime" not-null="true"/>
</property>
<property name="EditByID" type="Int32">
<column name="EditByID" length="4" sql-type="int" not-null="true"/>
</property>
<property name="AddByID" type="Int32">
<column name="AddByID" length="4" sql-type="int" not-null="true"/>
</property>
<!-- many-to-one foreign key relationships -->
<!--<one-to-one name="prf_StdProfileItemTitle" class="LightsCore.prf_StdProfileItemTitle, LightsTogether.Profiles.Data">
<column name="TitleID" length="4" sql-type="int" not-null="true" unique="true" index="PK_MemberProfileArea"/>
</one-to-one>-->
<many-to-one name="ProfileSection" class="LightsCore.prf_ProfileSection, LT.Profiles.Data">
<column name="SectionID" length="4" sql-type="int" not-null="true"/>
</many-to-one>
<one-to-one name="ItemAdapter" class="LightsCore.prf_ItemAdapter, LightsTogether.Profiles.Data">
</one-to-one>
<!-- end of many-to-one foreign keys -->
<!--<bag name="ProfileItemPicks" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="TitleID"/>
<one-to-many class="LightsCore.prf_ProfileItemPick, LightsTogether.Profiles.Data"/>
</bag>-->
<!--<bag name="ProfileItems" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="TitleID"/>
<one-to-many class="LightsCore.prf_ProfileItem, LightsTogether.Profiles.Data"/>
</bag>-->
</class>
<class name="LightsCore.prf_ProfileSection, LightsTogether.Profiles.Data" table="prf.ProfileSection">
<id name="Id" type="Int32" unsaved-value="null">
<column name="SectionID" length="4" sql-type="int" not-null="true" unique="true" index="PK_MemProfileSection"/>
<generator class="native" />
</id>
<property name="SectionName" type="String">
<column name="SectionName" length="50" sql-type="varchar" not-null="true"/>
</property>
<property name="TitleLabelId" type="Int32">
<column name="Title_LabelId" length="4" sql-type="int" not-null="false"/>
</property>
<property name="DescriptionLabelId" type="Int32">
<column name="Description_LabelId" length="4" sql-type="int" not-null="false"/>
</property>
<property name="IsEnable" type="Boolean">
<column name="IsEnable" length="1" sql-type="bit" not-null="true"/>
</property>
<property name="EditOn" type="DateTime">
<column name="EditOn" length="4" sql-type="smalldatetime" not-null="true"/>
</property>
<property name="AddOn" type="DateTime">
<column name="AddOn" length="4" sql-type="smalldatetime" not-null="true"/>
</property>
<property name="EditByID" type="Int32">
<column name="EditByID" length="4" sql-type="int" not-null="true"/>
</property>
<property name="AddByID" type="Int32">
<column name="AddByID" length="4" sql-type="int" not-null="true"/>
</property>
<!-- many-to-one foreign key relationships -->
<!--<many-to-one name="prf_ProfileGroup" class="LightsCore.prf_ProfileGroup, LightsTogether.Profiles.Data">
<column name="GroupID" length="4" sql-type="int" not-null="true"/>
</many-to-one>-->
<!-- end of many-to-one foreign keys -->
<bag name="ProfileItemTitles" inverse="true" lazy="true" cascade="all-delete-orphan">
<key column="SectionID"/>
<one-to-many class="LightsCore.prf_ProfileItemTitle, LightsTogether.Profiles.Data"/>
</bag>
</class>
</hibernate-mapping>