I'm sure I'm just doing something a little wrong, but I wanted to
eager-load the objects represented by these lines in my hbm:
<many-to-one name="CreatedBy" class="User" column="CreatedByUserUID"
access="field.camelcase-underscore" cascade="none" not-null="true"
foreign-key="FK_Users_WorkflowItems_CreatedBy" fetch="join" />
<many-to-one name="OwnedBy" class="User" column="OwnedByUserUID"
access="field.camelcase-underscore" cascade="none" not-null="true"
foreign-key="FK_Users_WorkflowItems_OwnedBy" fetch="join" />
At first I tried using "FetchMode.Eager" in my DAO for retrieving the
class (WorkflowItem) that contains the above associations:
ICriteria crit = NHibernateSession.CreateCriteria(typeof(WorkflowItem), "wf");
crit.SetFetchMode("wf.CreatedBy", FetchMode.Eager);
crit.SetFetchMode("wf.OwnedBy", FetchMode.Eager);
But the above code did not produce the expected joins in the output
SQL. Adding 'fetch="join"' in the hbm works like a charm.
Any ideas?
Thanks,
Luke