Try .SetFetchMode(relation, FetchMode.Join);
instead of Eager.

On Thu, Oct 16, 2008 at 8:25 PM, joe <[EMAIL PROTECTED]> wrote:
>
> Hi.
>
> I am trying to use the criteria API to eager fetch a many to one
> property.
>
> ICriteria criteria =
> NHibernateSession.CreateCriteria(typeof(Customer)).Add(Expression.Eq("ID",
> id));
> criteria.SetFetchMode("State", FetchMode.Eager);
> return criteria.UniqueResult<Customer>();
>
> The generated sql does do the join in order to retrieve the "State"
> association property, however, my customer object's state property is
> not initialized (it is not null but only the id is set).
>
> Am i missing something ?
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to