Hi,
Not sure what I am doing incorrectly here with NHibernate. I have two mapping files mapped to two tables. I can insert data through the mapping into the database, but calling the below code returns 0, even though I can see a child row populated in the table with the correct foreign key. Is this a lazy loading issue? Thanks.
var result = session.Get<AnnualReport>(annualReport.ReportID);
Assert.AreEqual(result.MonthlyReports.Count, 1);
Here are my mapping files.
AnnualReport class
<joined-subclass name="AnnualReport" extends="Report" table="AnnualReports" >
<key column="ReportID"/>
<property name="MonthlySendDate" />
<bag name="MonthlyReports" lazy="true" inverse="true">
<key column="ReportID" />
<one-to-many class="MonthlyReport"/>
</bag>
<many-to-one name="Client" column="ClientID" not-null="true" /></joined-subclass>
MonthlyReport class
<joined-subclass name="MonthlyReport" extends="Report" table="MonthlyReports">
<key column="ReportID"/>
<property name="SentDate" />
<many-to-one name="AnnualReport" class="AnnualReport" column="AnnualReportID" not-null="true"/>
<bag name="MarketReports" cascade="all">
<key column="MonthlyReportID" />
<one-to-many class="MarketReport"/>
</bag>