about many-to-one with "join fetch" but null, there is an open issue.
2009/3/11 Chucara <[email protected]>

>
> Let me start by explaining the behavior I'm looking for:
>
> - When I load an entity with "from Entity", I just want the entity
> itself, nothing else.
> - I then want to manually specificy which relations should be eager
> loaded.
> - In my example, all relations are many-to-one.
> - I don't want to use Proxies as I never want to use nHibernate's lazy
> loading
>
> But I can't seem to eager load properly.. It does eager load, but
> nHibernate touches the database several times. I need one single
> select.. join query.
>
> I've tried the following:
>
> string queryString = "from Job job "+
>                "left outer join fetch job.ManufacturingStep " +
> // ...
>                "left outer join fetch job.Parent " +
>                "";
> var tmp2 = session.CreateQuery(queryString).List();
>
> and
>
>            var query = session.CreateCriteria(typeof(Job))
>                .SetFetchMode("ManufacturingStep", FetchMode.Join)
>             // ...
>                .SetFetchMode("Parent", FetchMode.Join);
> var tmp = query.List();
>
> How can I do this query in a single database call? I've also tried
> FetchMode.Eager
>
> The relationships are defined as follows:
> <many-to-one name="Parent" column="ACT_PARENTREF" class="ActivityBase"/
> >
>
> The classes for the related entities like this:
> <class name="Lmc.Mars.Std.Model.ManufacturingStep, Lmc.Mars.Std"
> table="STD73_UDV.MANUFACTURING_STEP" lazy="false">
>
> I can't seem to wrap my head around how this works.. It seems no
> matter what I do, I get the same result.
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
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