Hi,
Is it possible to initialize collections without fetching parents?

For example with following mapping

public class EntityAMap : ClassMapping<EntityA>
{
    public EntityAMap()
    {
        Id(m => m.Id);
        Bag(m => m.OneToManyB, cm =>
        {                
            cm.Inverse(true);
        }, m => m.OneToMany());
    }   
}

I want to fetch OneToManyB for several parents.
The closest I have come is using ChildFetch

session.QueryOver<EntityA>()
                .Fetch(SelectMode.ChildFetch, e => e)
                .Fetch(SelectMode.Fetch, e => e.OneToManyB)
                .Where(e => e.Id.IsIn(ids))
                .List();

but then there still is an unnecessary join with the parent table

SELECT this_.id                as id1_0_1_,
       onetomanyb2_.Parent     as parent2_2_3_,
       onetomanyb2_.id         as id1_2_3_
FROM   EntityA this_
       left outer join EntityB onetomanyb2_
         on this_.id = onetomanyb2_.Parent
WHERE  this_.id in (1,2,3)


-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nhusers/adc83311-4f4a-4048-bdb9-87cf28e8d23dn%40googlegroups.com.

Reply via email to